-->
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.  [ 1 post ] 
Author Message
 Post subject: Entities being getting detached.
PostPosted: Wed Oct 05, 2011 7:25 pm 
Newbie

Joined: Fri Nov 25, 2005 4:44 pm
Posts: 12
I'm trying to figure out what is going on but, from what I can tell it looks like the Session 'at random' is detaching entities that were previously created on that same session..i.e. 9/10 times the code below works just fine..

Essentially the code is doing the following: (entity is created/commit in transaction 1, then later updates (on the same session) on a different transaction..and ~1/10 times it fails due to detached entity.

Code:
tx = getEntityManager().getTransaction();  // (bound to threadLocal..or created if one not already created)
tx.begin()
Pojo pojo = new Pojo();
Pojo2 pojo2 = new Pojo2();
pojo2.setPojo(pojo);
tx.commit();
..
..
tx = getEntityManager().getTransaction(); // return threadLocal entityManger or one created (verified same address as one above)
tx.begin();
pojo.setStatus("success");
tx.commit();              <-- PersistenceException detatched entity passed ..Pojo




so my question is..I have full hibernate logging turned on, yet..I see no messages indicating if/when the entities are getting detached...
Is there anything I can look for explictly in the logs to see when/where/what is getting detached when?...obviuosly I can 're-attach by issue a new query, but that feels wrong, and obviously is performance hit).

any thoughts/pointers?


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

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.