-->
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: Calling remove on collection, deletes persist immediately?
PostPosted: Fri Sep 16, 2005 5:06 pm 
Can anyone tell me under what circumstances does a call like this

customer.Orders.Remove(someOrder);

persist the changes to the DB immediately? I am making a change to the object and I am 99% sure I am not calling session.SaveOrUpdate.

Can someon verify if this is possible to do? I've been spinning my wheels for hours and I have checked and re-checked to make sure I am not saving.


Top
  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 5:09 pm 
If it helps, can someone explain this? What does "value type" and "entity" mean in this context?

#

If an object that was removed from a collection is an instance of a value type (eg, a composite element), that object will cease to be persistent and its state will be completely removed from the database. Likewise, adding a value type instance to the collection will cause its state to be immediately persistent.
#

On the other hand, if an entity is removed from a collection (a one-to-many or many-to-many association), it will not be deleted, by default. This behavior is completely consistent - a change to the internal state of another entity should not cause the associated entity to vanish! Likewise, adding an entity to a collection does not cause that entity to become persistent, by default.


Top
  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 10:42 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The logs would help in this case. All changes to collections are only persisted during Flush, but Flush may be done implicitly during some operation (most often before executing a query).


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.