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.  [ 3 posts ] 
Author Message
 Post subject: One to many, many to one, design advice
PostPosted: Mon Jul 31, 2006 7:17 am 
Beginner
Beginner

Joined: Wed Apr 19, 2006 9:16 am
Posts: 24
Hibernate version: 1.0.2

Hi all,

In my design, the following relationships exists:
EntityA has a one to many relationship with EntityB, which in turn has a one to many relationship with EntityC.

The number of objects involved runs into hundreds at best, ten thousands at worst. EntityA has to be passed through a webservice, so the entire objectgraph needs to be loaded.

Since this is rather costly, I was thinking of reversing the relations into a many to one relations: EntityB has a many to one to EntityA, EntityC has a many to one to EntityB, and EntityA knows nothing (in a mapping sense) about either EntityB and EntityC.

Functionally, this is perfectly acceptable, since users don't work with the entire objectgraph at once anyway, but I was wondering if this is considered an acceptable or (despised) practise from a design and NHibernate point of view.

Any thoughts?

_________________
regards,
Willem van Rumpt


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 8:16 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This is perfectly fine from NHibernate's point of view, see http://blog.hibernate.org/cgi-bin/blosxom.cgi/2006/01/25#collectionmapping. As from the design point of view, I would say it depends. In your case I think the compromise is justified.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 8:46 am 
Beginner
Beginner

Joined: Wed Apr 19, 2006 9:16 am
Posts: 24
Thanks for corroborating my thoughts on the subject (and the link).

I'll take the many-to-one route. The design incurs a slight hit by dropping the link, but I too felt it to be a justifiable choice.

_________________
regards,
Willem van Rumpt


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