-->
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.  [ 6 posts ] 
Author Message
 Post subject: Replication and Lazy Loading
PostPosted: Fri Sep 30, 2005 1:42 pm 
Beginner
Beginner

Joined: Fri Mar 04, 2005 7:12 pm
Posts: 34
Hibernate version:
3.05

I am trying to implement replication using two sessionfactory objects and I can easily move data in a single table, etc. using code similar to the reference manual.

However, my actual database is a series of seven entities that are related by sequential one to many relationships. For example, a clinical trial network contains clinical sites contain different studies contain specific patients contain data.

I would envision loading one network from database A with sessionA, detaching it by closing sessionA, and then open sessionB and replicate the network. But since lazy loading is anticipated, I am expecting to get a Hibernate exception since the object is detached from sessionA.

Is there a solution to this situation?

Thank you.

_________________
J. Michael Dean, MD


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 9:46 pm 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
Is there a reason why you couldn't eagerly load for a particular usage scenario to avoid this issue?

_________________
Joe W


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 10:56 am 
Beginner
Beginner

Joined: Fri Mar 04, 2005 7:12 pm
Posts: 34
My object hierarchy may include hundreds of thousands of objects at the lowest level. But I think what you say is correct - I will have to have a strategy to pick a segment of the tree that I wish to replicate, and load it eagerly, or figure out a way to simply batch move the records without going through Hibernate. The latter is probably sensible, but I envision allowing a user to select a subsegment of the data that is ready for transmission to the "mother ship"; we are dealing with numerous hospitals participating in clinical trials, and we want them to send data on specific patients after all the data have been locally collected and validated, etc.

_________________
J. Michael Dean, MD


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 11:07 am 
Beginner
Beginner

Joined: Tue Aug 23, 2005 3:52 pm
Posts: 26
If this is a very specific operation that is not performed very often you can keep the session open. Or maybe this is not a job for Hibernate and should be dealt with on the DB level.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 12:44 pm 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
Keeping the session open is not an option. Replicate is very strict about the "detached" nature of the object you're trying to replicate.

You can't pull from one db with one hand and push that info into the other with another hand.

Sounds like this may not be an ORM job.

Replicate is probably one of Hibernate's checkmark features ("yeah, we have that") but not something they really see much use for in an ORM environment.

I think replicate is very useful in at least a few cases even in ORM environment.

_________________
Joe W


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 1:31 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Another option, if you're replicating all of the data or if it's easy to determine which data to replicate at the object level would be to disable cascading for replicate and replicate the objects in the tree one level at a time.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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