-->
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: Guidance in updating objects loaded in the previous session.
PostPosted: Tue Jun 15, 2004 8:43 am 
Newbie

Joined: Sat Jun 12, 2004 12:45 am
Posts: 1
Hi,

I have been trying out the various update options in Hibernate.
These options are being evaluated for load in one request and update the changed records in the next request.

We are following a session-per-request pattern.

The project requires me to write update statements, updating only the fields which have changed.

As I understand Hibernate provides me with three options
1. Load the object again in the new session and perform an update. This option has an extra select clause associated with it, which I want to avoid.

2. Updating an object which has been loaded in the previous session.
Here I am facing two problems
i. The update statement fires an update on all the columns, even if only one column is changed.
ii. In the case of an one-to-many relationship with cascade enabled, all the child rows get updated when the parent is updated.

This option hence fires too many queries.

3. There is one more option where I can do a session.lock on Lock mode NONE and store the object in the cache in the first session and in the subsequent session I will have to retrieve the object from the cache and apply the changes.

This option works fine. However the decision as to when should the cached object be removed from the session, leads to a huge overhead.
i.e. If the user views the screen and does not press save. There is no way of clearing the session. (My appl. is a rich client app and there is no session timeout feature)

Hence I am constrained in all the features of update.

I need some guidance on the method to be used.

_________________
Manoj Karanth


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.