-
1. Re: many-to-many initialization
epbernard Aug 18, 2005 8:35 PM (in response to zihong)I've been a bit aggressive in my lazyness of many to many. I think I'm gonna relax that in the next release to allow objects to be initialized when the @ManyToMany collection is touched.
Note that the spec allow such an aggressive lazy loading, so a code expecting to be portable should not rely on the object loading except if all the objects state are touched, a "fetch" keyword is used in HQL or the collection is marked as EAGER -
2. Re: many-to-many initialization
zihong Aug 19, 2005 1:32 PM (in response to zihong)Thanks for the reply, and for relaxing the aggressive lazy loading of many-to-many in next release. I do think that the behavior should be consistent for both one-to-many and many-to-many, aggressive or not. Would you like me to enter an entry in JIRA? If so, is this a bug or a feature request?
On a slightly different aspect, I think the spec needs to address the following:
1. in entity manager, need a way for forced initialization of all relationships of a bean, one similar to Hibernate.initialize(parent).
2. forced initialization of selected relationship. For example, entity A has a relationship with entity B as AB, and has a relationship with entity C as AC, it will be very convenient to have initialzing only relationship AB without initializing relationship AC. This is what my BeanAObject.getBeanBList().size() is intended to accomplish, and the behavior that Hibernate supports.
The "fetch join" can do both. However, the pitfall of "fetch join" is that you are required to write bean specific HQL, while the 2 items that I mentioned don't.
-Zihong -
3. Re: many-to-many initialization
epbernard Aug 20, 2005 8:19 PM (in response to zihong)I've fixed that already, so no need for JIRA issue.
And please forward your proposals to ejb3-pdr-feedback@sun.com
I basically agree with you.