-->
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: best practice for working with complex object
PostPosted: Wed Sep 07, 2011 11:56 am 
Newbie

Joined: Mon Oct 20, 2008 11:37 am
Posts: 7
Hello. Could anybody please recommend me what would be the best practice in my case?
1. My objects contains several one-to-many relationships with other objects, which in turn contain several one-to-many relationships. I do not want to keep an object in memory as a whole, so I use a lazy loading scheme.
2. A user works at a time with different parts of an object, but I want to save changes in the database only once, when the user clicks save. In addition an object or its part can be created from scratch. For this reason I want to detach an object immediately after reading it from the database and to keep in detached until it is time to save changes. However doing this prevents me from loading object branches, when needed (No session Exception).
3. This is a web application with Struts architecture. To make things simple I open Hibernate session just before a call to the action servlet and close it right after. This automatically detaches all read objects. I do not want to automatically reattach them to every new session. I would like to keep the objects detached until the last moment.

Summary. I want to be able to selectively read parts of an object from the database, but to save changes only when I want them to be saved.
Thank you,
Lev Tannen


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.