-->
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.  [ 3 posts ] 
Author Message
 Post subject: JPA Entity Manager & SessionFactory
PostPosted: Tue Jan 12, 2016 12:26 pm 
Newbie

Joined: Tue Jan 12, 2016 12:16 pm
Posts: 10
Hi

In my project I jave 2 persistence layers (2 jar projets : purpose is to migrate to JPA step by step transparantly).
- Core which uses Hibernate SessionFactory
- Jpa Core which uses EntityManager
Both use an identical jndi datatource
Each has its own Spring context, beans, and transactionManager.

My question is how can I have a transaction manager holding those 2 ?
Other point is we use Tomcat so no JTA.


Top
 Profile  
 
 Post subject: Re: JPA Entity Manager & SessionFactory
PostPosted: Tue Jan 12, 2016 1:04 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You cannot do it unless you use JTA. If you use two separate TM, then each one will control a separate database connection and issue the commit/rollback independently. If you share the same database connection, things can go out of sync since a transaction might be attempted to be committed twice, or committed and then rolled back.


Top
 Profile  
 
 Post subject: Re: JPA Entity Manager & SessionFactory
PostPosted: Wed Jan 13, 2016 5:12 am 
Newbie

Joined: Tue Jan 12, 2016 12:16 pm
Posts: 10
Thanks for your answer.
As we must use Tomcat (customer contractual request) whereas before we used Wild Fly (with JTA) because of cannot use JTA, so we must migrate functionnalities one by one with all services / daos involved.

Anthony


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