From: Kal A. <ka...@te...> - 2004-09-13 12:37:04
|
Hi Conal, I'm going to have to take a look at this in more detail - it may be that it will be possible to create a lower-level exporter specifically for the Hibernate backend that doesn't have this performance problem. In the meantime, I can only suggest that you take a look through Hibernate's documentation and that of your database to see if there are any runtime configuration options that might help improve performance. Cheers, Kal On Sun, 2004-09-12 at 23:54, Conal Tuohy wrote: > Thanks Kal! > > I opened a transaction before walking my topic map, but sadly it hasn't speeded it up at all :-( > > Here's the code I used: > > /* get the topic map from the topic map manager */ > var TopicMapManager = cocoon.getComponent("org.tm4j.tm4web.cocoon.TopicMapManagerComponent"); > var map = TopicMapManager.getTopicMap("nzetc"); > cocoon.releaseComponent(TopicMapManager); > > /* write the topic map to a file */ > var walker = new Packages.org.tm4j.topicmap.utils.TopicMapWalker(); > var writer = new Packages.org.tm4j.topicmap.utils.XTMWriter(); > var file = new java.io.File(export_filename); > var os = new java.io.FileOutputStream(file); > var of = new Packages.org.apache.xml.serialize.OutputFormat(); > of.setEncoding("UTF-8"); > of.setIndenting(true); > of.setIndent(2); > var serializer = new Packages.org.apache.xml.serialize.XMLSerializer(os, of); > walker.setHandler(writer); > writer.setContentHandler(serializer); > > var txn = map.getProvider().openTransaction(); > try { > walker.walk(map); > } finally { > txn.abort(); > } > > /* walker.walk(map); */ > cocoon.sendPage("export/nzetc.xtm"); > > Cheers > > Con > > > My guess is that the walk is just doing to many transactions. If you > > don't have an "outer" transaction wrapping that walk, then > > each call to > > the API will result in a separate transaction against the database - > > which amounts to quite a lot of transactions to walk the whole map. > > > > What I would recommend you try is creating a transaction to > > wrap around > > the walk. If a transaction is already in progress, then the TM4J > > Hibernate code will use that txn instead of creating one. > > > > The code would be something like this: > > > > ProviderTransaction txn = provider.getTransaction(); > > try { > > walker.walk(); > > } finally { > > txn.abort(); > > } > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users -- Kal Ahmed <ka...@te...> techquila |