From: Kal A. <ka...@te...> - 2004-05-17 15:13:47
|
Hi Andy, There is a way to make more coarse-grained transactions with the Hibernate backend. The relevant methods are: TopicMapProvider.isTransactional() which returns true if the backend supports transactions (currently only the Hibernate backend does). TopicMapProvider.openTransaction() which starts a new transaction and returns a org.tm4j.topicmap.ProviderTransaction instance. TopicMapProvider.getOpenTransaction() which returns a handle to the current transaction. and then the methods of org.tm4j.topicmap.ProviderTransaction which you can use to commit or rollback the transaction. Currently nested transactions are not supported at all, but the hibernate implementation only starts a new transaction for an API call if one is not already started, so you should be able to do something like: txn = tm.getProvider().openTransaction(); // Do some stuff here txn.commit(); // or txn.rollback() This is all in the 0.9.x API BTW. Hope this helps! Cheers, Kal On Mon, 2004-05-17 at 15:14, Andy Peel wrote: > Hello, > > I'm working on integrating use of TM4J and TMAPI into our application. > There's a couple of possible showstoppers though. > > Firstly, the Hibernate implementations classes do a commit whenever a > suitable operation has completed, such as when a new topic is created, or an > occurence is added to a topic. What we'd like to do is control the commit > overselves and do it at a higher level. Thus a single transaction may > include multiple topics, associatons, occurences, etc. being created, > updated or deleted. > > The other issue is that there doesn't seem to be a way of preventing > modification by more than 1 user at the same time. Using Hibernate's > optimistic lock mechanism would be one option here. > > So I guess there's a couple of questions. Firstly, has anybody has to build > workarounds for these before, and secondly, is there any plan to put these > into TM4J? > > > Andy. > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: SourceForge.net Broadband > Sign-up now for SourceForge Broadband and get the fastest > 6.0/768 connection for only $19.95/mo for the first 3 months! > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > _______________________________________________ > Tm4j-developers mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-developers -- Kal Ahmed <ka...@te...> techquila |