-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: JTA - transaction strategy: SUPPORTS vs REQUIRED
PostPosted: Thu Dec 18, 2003 3:45 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
Hi All -
I'm using hibernate 2.1 and Spring M3, I think this question boils down to hibernate only:

To use JTA transactions, I would like my hibernate session to participate when a transaction *already exists*, and otherwise, create a JDBC transaction.

I don't see a way to do this, or that it is considered in the code - you can configure *either* JTA, JDBC or none transaction manager - correct?

The problem I have is when a JTA transaction exists, if the hibernate transaction is committed, then when the container commits the JTA transaction, it throws an exception, since it is already commited.

Is the only way to set this up to create my own net.sf.hibernate.transaction.TransactionFactory and net.sf.hibernate.transaction.Transaction that:
- check for a current JTA transaction
- if found, use that transaction, and do not commit it
- if NOT found, create a JDBC transaction, and DO commit it

does this make sense? Is there some better way to approach this? The only other alternative I can think of is to move this logic to my application code and only init the hibernate transaction when a JTA transaction exists, and do not commit it. It seems like this could be a potential problem, though...

any feedback is appreciated

thanks!
Tyson


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2003 4:22 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
Tyson,

Please lets keep this discussion in http://forum.hibernate.org/viewtopic.php?t=926452. I don't know where to answer else ;-)

I've just indicated there that Hibernate's JTATransaction (and thus Spring's HibernateTransactionManager) already implements the pattern you propose: Participate in an existing JTA transaction, create a new one else.

The problem is that in the latter case, Hibernate tries to check the SQL warnings via Connection.getWarnings: Unfortunately, WebLogic's JTA is so restrictive that it doesn't even allowing for getWarnings after a transaction commit!

Juergen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.