-->
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: Using LTC in J2EE environment with Hibernate
PostPosted: Fri May 06, 2005 11:56 am 
Newbie

Joined: Fri May 06, 2005 11:36 am
Posts: 2
Hi,
We have an application in which we are trying to integrate Hibernate. I've read some very good posts here that talking about this, however they all (same as hibernate in action book) suggest using transaction for everything. I've been reading IBM articles about LTC in J2EE environment and they also recommend always execute db-related code in global transaction (which implies using shareable connection).
QUESTION: Nothing I have read point to not using global transaction as being a problem. Is it ?

I do know that using LTC will actually get me multiple physical connections when ds.getConnection() is called unless I close connection handle, but is it necessary a bad thing? (it could be if we call getConnection() multiple time in the same request without closing handles, but we try to avoid this)

QUESTION: How much overhead is it to always create a transaction? Even if we endup never hitting database (we have caching in place)?

APPLICATION: our app does not have EJBs - everything runs in WEB container and we don't use UserTransaction (we are however are starting to introduce EJBs for certain things). We have an implementation of PersistenceManager that we put together after reading Hibernate In Action book (which was the first step), and we are trying now to cleanup/fix the rest of the code that was originally executed in LTC transaction (second step - currently we wrapped all that code in transactions).
QUESTION: The reason I am looking at the second step is because I thought creating global transaction is an overhead. Is it?

One of the solution we are looking at is as follows: keep using PersistenceManager and wrap every Manager-layer method in transaction (and let PersistenceManager do reference counting to determine when actually to start/commit/rollback transactions). We are considering using AspectJ to wrap each method in transaction to keep the code clean.

Sorry for the long message, however this is all in my head spinning and will drive me crazy until I understand indepth every plus and minus to every approach. In the meantime, I am rereading Hibernate In Action and Professional EJB 2.0 sections that deal with transactions and connections

thanks a lot for the help

Andrey


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 1:45 pm 
Newbie

Joined: Fri May 06, 2005 11:36 am
Posts: 2
Well, it's starting to come together so I am starting to answer my own questions:

Question1: no it's not. Every EJB with transaction NotSupported is in LTC. The difference between global and local transaction is connection sharing scope (as long as connections are shareable)

Question2: not a fair question. I did not explain which transaction I am taling about. Creating hibernate transaction is not the same as creating database transaction and does not seem to be an overhead.

Question3: when using hibernate, I don't really deal with LTC and global transactions myself - hibernate takes care of all of this.


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.