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: Entity incorrectly being saved during transaction
PostPosted: Fri Jan 15, 2010 4:24 pm 
Beginner
Beginner

Joined: Thu Jan 29, 2009 1:24 am
Posts: 20
I'm using JPA, Hibernate 3.3 and Spring Transactions my database access. I'm noticing odd behavior during a transaction. Essentially if I pull an entity and then make modifications to it but never actually call the merge or persist function in the EntityManager Hibernate still saves all my changes. Unfortunately I can't just make my changes outside of the transaction so i'm wondering how I can enforce Hibernate to not save any changes unless I explicitly call the merge function.


Top
 Profile  
 
 Post subject: Re: Entity incorrectly being saved during transaction
PostPosted: Sun Jan 17, 2010 1:03 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Perhaps you could evict the entity, dislodging it from the Sessions grasps?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Entity incorrectly being saved during transaction
PostPosted: Tue Jan 19, 2010 7:06 pm 
Beginner
Beginner

Joined: Thu Jan 29, 2009 1:24 am
Posts: 20
Cameron McKenzie wrote:
Perhaps you could evict the entity, dislodging it from the Sessions grasps?


That could work. Unfortunately I don't see any detach or evict functions in EntityManager. How do I evict an entity from JPA's EntityManager?


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.