-->
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: session-per-conversation with save-points
PostPosted: Thu Jun 14, 2007 2:37 pm 
Newbie

Joined: Tue Jun 05, 2007 12:03 pm
Posts: 2
I'm currently writing an application with a web front end which has a sequence of pages which populate a domain model, (in a wizard style).

After each page has been submitted the populated domain object(s) should be persisted to the database.

I'd like to avoid a database hit, when the user submits a page, but has made no changes to the domain model, for efficiency and auditing reasons.

Can anyone out there give me advice on the best way to accomplish this?

Currently I'm trying to use the session-per-conversation approach, as this allows me to let Hibernate manage the dirty checking, and only update actual changes to the database on calling merge(). If I use session-per-request, then HIbernate will always perform an update to the database on reattachment of the domain objects, even if no changes have been made.

Question is - is this the best approach? Should I still be using the session-per-conversation approach when I am having intermediate save-points which flush the session and obviously violate the atomicity of the transaction?

I think my session-per-request alternatives are:

1) Activate the select-before-update Hibernate feature to select the object and only update it if it differs - obviously this still invloves a hit to the database, (albeit less expensive), but there has been no update which satisfies auditing requirements.

2) Perform manual dirty-checking before deciding whether to perform an update or merge.

Any advice on this would be appreciated there doesnt seem to be much material on this, even though the Hibernate team recommended using long conversations in the original Hibernate In Action book.


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.