| Author |
Session update method in hibernate?
|
scott miles
Ranch Hand
Joined: Jun 16, 2011
Posts: 70
|
|
I am new to hibernate and going through hibernate tutorial. While going thru update method in session i found below statement at
http://docs.jboss.org/hibernate/annotations/3.5/api/org/hibernate/Session.html#update(java.lang.Object)
void update(Object object) Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped with cascade="save-update.
I have a question about statement If there is a persistent instance with the same identifier, an exception is thrown. I could not understand this statement. As per my understanding - persistent instance with the same identifier needs to be there in database to update the value Sure i am missing something here. Looking for that miss?
Statement2
"This operation cascades to associated instances if the association is mapped with cascade="save-update". I think whatever the associations are there in persistent instance , they will also be updated if the association is mapped with cascade="save-update. Right? like customerinfo has accountinfo. So if we make change in customerinfo and accountinfo both. Both the changes will be persisted.
|
 |
 |
|
|
subject: Session update method in hibernate?
|
|
|