Yep, defining fetch groups could help you here. I have this same behavior in a number of entities with multiple collection-valued references. Here are some links to the doco on this subject which you might find useful:
http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_fetch http://openjpa.apache.org/docs/latest/manual/manual.html#openjpa.FetchGroups http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_overview_join_fetch http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_hints_fetchplan http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_langref_fetch_joins http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_langref_fetch_joins Cheers, -- Alex On Jan 16, 2008 10:53 AM, SomuReddy <[EMAIL PROTECTED]> wrote: > > Hi Alexander, > > Thanks for your information, but I am not using the any join( LEFT JOIN > FETCH) in query, I am just specifying the relationship like this.. > > @OneToMany(mappedBy = "fireRsrcDO", cascade = CascadeType.PERSIST) > List<FireRsrcVersionDO> fireRsrcVerDOList = null; > > by defaullt OneToMany fatch type is "lazy loading", so problem is when i > close the EntityManager after execution of query(Query is executing on > one > of the dataobject where i specified all these relationships) , data is not > fetching. > Can i use the fetch groups here??? > > Thanks, > Somu > > > Alexander Saint Croix-2 wrote: > > > > Hi. > > > > You should look into using the LEFT JOIN FETCH clause in your query, and > > perhaps should also look at whether some of your collection valued > > references can be set to FetchType.EAGER without causing the cascading > to > > spiral out of control and pull down the entire database. A third > solution > > is to look into using Fetch Groups. > > > > HTH, > > -- > > Alexander R. Saint Croix > > (a user, like you) > > > > > > > > > > On Jan 15, 2008 3:05 PM, SomuReddy <[EMAIL PROTECTED]> wrote: > > > >> > >> Hello, > >> > >> I am creating the own EntityManger for each query to execute? is it > >> required to close the EntityManger after execution of the each Query, I > >> have > >> lazy loading(fetch type) on my data objects with some > relationships(like > >> OnetoMany, ManytoOne and ManytoMany), If I close the EntityManger after > >> the > >> Query execution, i couldn't get data thru relationships as it defined > >> fetch > >> type is "Lazy" and EntityManger is no more active. > >> > >> is there any other soultion except changing the fetch type is from lazy > >> to > >> Eager.. or I should not close the EntityManger after query execution, > If > >> I > >> won't close the EntityManager what are the Cons????? > >> when EntityManager instance will be garabage collect???? > >> > >> Any idea on this??? > >> > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/EntityManger-close-against-the-Query-and-lazy-Loading-tp14847417p14847417.html > >> Sent from the OpenJPA Users mailing list archive at Nabble.com. > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/EntityManger-close-against-the-Query-and-lazy-Loading-tp14847417p14885514.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. > >
