-->
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: joined tx (with resource_local tx and application-manag. em)
PostPosted: Fri Feb 16, 2007 10:59 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
Hello!

I am using Hibernate 3.2.2.ga with hibernate 3.2.0.ga entitymanager and 3.2.0.ga annotations.

I am using a Java SE environment. This means, an extended context, application managed entity managers, and resource local transactions.

The documentation for application managed entity managers says: "When you create an entity manager inside a transaction, the entity manager automatically join the current transaction."

I have the following (pseudo) code:
Code:
//create entity manager factory
EntityManagerFactory emf = configuration.buildEntityManagerFactory...

//create the first (outer) entity manager
//this also creates our persistence context
EntityManager em_outer = emf.createEntityManager();

//start transaction
em_outer.getTransaction().begin();

//now we create a second entity manager
//the inner entity manager should join the current transaction
em_inner = emf.getEntityManager();

//make a merge with some object
em_inner.merge(object);

//now we close the transaction
em_outer.getTransaction().commit();
em_outer.close();


this doesn't work for me. I have tried a lot, but without success. Only the merge EventListeners are fired, but no records are merged.

Any ideas?

Regards,
Chr.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 17, 2007 6:23 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
do I have some form of this: http://forum.hibernate.org/viewtopic.ph ... ty+manager


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.