-->
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: Insert and then delete of same entity
PostPosted: Fri Oct 01, 2004 5:40 am 
Newbie

Joined: Fri Aug 20, 2004 10:07 am
Posts: 9
Location: Sweden
Hibernate version:
2.1.4

What happens if I delete a newly created entity before flushing, ie:
Code:
session.save(entity);
session.delete(entity);
session.flush();


Testing indicates that Hibernate tries to insert the entity and then delete it from database, which is quite unnecessary. Is this the expected behaviour?

Of course the code sequence is crazy if it would occur in one spot but in our case the method that calls delete has no idea if the object has been previously flused or not. To avoid the above sequence we would have to keep some kind of entity state in application code which seems out of place, it feels like this should be the responsiblity of the ORM.

/Peter


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.