-->
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: Advice on how to copy a largish graph
PostPosted: Sun Dec 18, 2005 11:39 pm 
Newbie

Joined: Mon Oct 11, 2004 1:30 pm
Posts: 15
Location: New York, NY
Hibernate version: 3.0.5
Name and version of the database you are using: Sybase ASE 12.5

I have a set of tables in the database that represent a fairly complex tree of relations: 6 layers deep in its deepest dimension (A-F), and then additional relations between A and 4 other entities (G-J)

Code:
    A --> B --> C --> D --> E --> F
    |
   +->G
    |
   +->H
    |
   +->I
    |
   +->J


The relations are as follows:

Code:
              A--*B        B--*C
              A--*G        C--*D
              A--*H        D--*E
              A--*I         E--*F
              A--*J


For business reasons, the application can get called upon to do a deep copy of the entire tree, given an identifier to entity 'A'. There will always be rows in each of the entities all the way down to 'F' & 'J' and the application will always need to copy all of this data when summoned to do so.

It is copying the data from one set of tables to a mirrored set in the same database. Each entity in the hierarchy will have at most 5-6 rows, but the application may be summoned to do a deep copy on a few dozen trees rooted at A at a time.

I'm currently in development, and am doing the writing by having cascade="all" on each of the "<set>" tags in the HBM descriptors for all of the entities. I'm also using batching as per the writeup in Section 13.1 of the ref docs. I'm assuming this is all kosher. (Any comments are welcome on this!).

My real question lies in finding the best strategy for reading the graph out of the database. The querying is currently set to the default -- all relations are lazy. Since there are a lot of joins going on, I'm wondering if Hibernate would do better with leaving it as is (i.e. lazy querying) or by setting it to do eager (i.e. join-based) fetching on all of the relations, and pulling the entire graph out at once.

I'm very interested to hear any comments/discussion on this, or pointers to other discussions on same.


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.