[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Optimize query on many OneToMany of same type
|
Hi,
I have an rich object model with a root object having two (or more) OneToMany of the same type.
For example :
A user (Entity Item) having a list of DoneItems (Entity Item) and a list of TodoItems (Entity Item).
Of course it could be simpler to merge the two list in one in my model but I would like to know if there is a way to optimize the 2 SQL queries retrieving the two collections in only one.
JoinFetching is bad idea and BatchFetching won't probably help me.
In my real case, I have 6 relations this kind on the same root object.
The only solution I see is to fake the lists in my model by creating an internal list with an only one OneToMany. When browsing the items of one of those lists, I would filter the items of the internal list. When adding an item to one of the lists I would add it to the internal list.
This solution is the new problem as I won't be able to fetch the lists selectively.
Any ideas ?