-->
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.  [ 4 posts ] 
Author Message
 Post subject: Complex collection mapping requirement
PostPosted: Thu Feb 03, 2005 5:38 pm 
Newbie

Joined: Thu Feb 03, 2005 5:27 pm
Posts: 5
I have a database structure that models a forest of trees in a single table.
This is achieved by the table having 3 fields, the primary key, the primary key of its parent item (pointing to the same table), and a field to identify which tree in the forest this node belongs to.

Due to performance issues, I am not referencing the 'parent' or 'child' elements as 'classes', but just as strings of the promary keys.
So the children collection would be a collection of PK strings, rather than the class objects themselves.

My issue is that the only way I can model this in a class is to have a Map of Sets of strings.
This would work perfectly, if I had tree1, tree2, and tree3, then

myobject.children['tree1'] woud be a Set of strings identifying the PKs of each child element.

Any idea how I would model this in an HBM?
I dont think its possible to place a <set> inside of a <map>...

Any ideas?

Thanks in advance.

- Adam Langley


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 7:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why dont you just use lazy=true on the classes ?

doing obj.getId() doesnt initialize a object so you wouldnt have any memory hit and you can work with objects instead of their string identity.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 7:43 pm 
Newbie

Joined: Thu Feb 03, 2005 5:27 pm
Posts: 5
Ah, I cant use lazy on the objects because I have to pass the object over web services, so I just want a localized portion of the tree,

ie, this node + parent IDs / child IDs
(its actually a MAP, not a TREE, which is why theres multiple parents...)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 3:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sounds like you should think of separating your "biz" object model from your "presentation" (the webservice objects)

_________________
Max
Don't forget to rate


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