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 ?
|