-->
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.  [ 4 posts ] 
Author Message
 Post subject: Cascade save-update option
PostPosted: Tue Feb 15, 2005 4:45 pm 
Newbie

Joined: Wed Sep 29, 2004 10:10 am
Posts: 13
Location: Washington D.C. USA
Dear All,

I am using Hibernate 2.1 version. I set cascade=save-update option in Hibernate configuration so that each parent object upon Save gets saved as well as its children. I was wondering if Hibernate has any kind of mechanism where it will update only those tables of which corresponding POJOs or objeects got modified ? I am just concerned about extra overhead involved in all possible children tables updates.

Thank you.
Ram Mahajan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 15, 2005 5:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
As long as you stay within session scope, only dirty objects will get updated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 15, 2005 6:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Outside of session scope, you can use select-before-update


Top
 Profile  
 
 Post subject: cascade=save-update
PostPosted: Tue Feb 15, 2005 6:39 pm 
Newbie

Joined: Wed Sep 29, 2004 10:10 am
Posts: 13
Location: Washington D.C. USA
Well, in my case, the objects go out of session scope.

1. The presentation layer requests a deep copy of parent object, then it modifies the parent object as well as some of its children objects as per the form data. The session at this point is closed.
2. After modifying the parent/child objects, the presentation layer calls businees and then Data layer to save it.
3. The data layer will again gets the session associated with the same thread. As the session is already closed, it will open a new session and does the saveOrUpdate operation.

In above scenario, I am worndering if Hibernate will update entire tree of parent object or will it only update the corresponding tables of modified objects ?

I do not see dirty bits in the POJO itself, so wondering how Hibernate will ever know the object's set method is called out of the session. If it does not, will it update unnecessary tables which might be an overhead.

Thank you.
Ram Mahajan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.