-->
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: how to map composition 1 to 20 entities
PostPosted: Fri May 15, 2015 4:37 am 
Newbie

Joined: Fri Mar 06, 2015 9:35 am
Posts: 3
Hei we are having the following case. Lets say that we have relation of composition between 1 entity lets say Car and another 30 entities that are owned by this first entity and can exist only in the context of this entity but are held in separate tables. This extra entities Car - extra entity may be OneToMany or OneToOne, most of the time OneToMany. Very often the Car needs to be cloned together with all the extra entities so they need to be loaded each time all of them. Now the problem is that this means a lot of extra queries and very often the Many side do not has any elements, so this results in large amount empty queries. I ah thinking of two ways to map this entities:
1. Intermediate Table where a row exist for the specific type of entity only if the many side contains at least 1 entity.
2. What about the Union relationships. Will this be fast ? There will be huge amount of null values going around though. Is this an option?

Basicly imagine one table with many many relationships OneToMany and these relationships most of the time return empty resultsets. And the Many side of the relationships are Owned by the One side, and they are bottom leafs of the object chain. So this entities don't have any more relationships.
What is the best way to map this thing ?


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.