-->
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.  [ 4 posts ] 
Author Message
 Post subject: JTA without EJB server
PostPosted: Tue Nov 13, 2007 11:06 am 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Hi,
I am trying to use JTA transactions with JPA / Hibernate without using an EJB server and to run in Tomcat.

In theory, I think this is possible, I should be able to use the JBossTS to provide JTA transactions. But, I am just wondering how would the EntityManager get associated with the JTA Transaction if I am not using dependency injection for EntityManager or the Transaction i.e. there is no App Server to make the connection?

Kind Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 13, 2007 11:16 am 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
This might not be the best answer you can get but here are my two cents. You will need to demarcate your calls to where it involves calls to EntityManager, possibly with UserTransaction, and you will have to configure your hibernate entity manager to lookup a transaction manager (through JNDI?) and the rest is transparent (provided your connection pool is also aware of the transaction manager).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 13, 2007 1:49 pm 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Just checking the documentation on this one.
In JPA you can specify in the persietence which JTA datasource the persistence unit should use. However, I can't find anywhere which states where you tell the JPA vendor which JNDI service to look up.

In the Manning book, (circa pages 96, 97, 98) it gives details for where to set the JTA datasource for a hibernate session, however again I can't see where you would tell the JPA vendor which JNDI to look up.

So I can't see anyway of doing this outside an AppServer?

Any ideas or links to wikis greatly appreciated?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 13, 2007 6:52 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
I don't have it on top of my head right now but I remember there was something like vendor specific properties in JPA. Check if you can set any hibernate properties that has something to do with transaction management. Something like: hibernate.transaction.manager_lookup_class


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.