[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Mapping Question
|
Ahh - this answers a question that I've been meaning to ask. I didn't
know why (or how) my entities were being lazy loaded when I wasn't
weaving or using the agent. Is this documented somewhere?
thanks,
Mike
christopher delahunt wrote:
Sorry, I understand the problem now. Though you have Lazy turned on,
it can only work on OneToOne and ManyToOne if you are using weaving.
Lazy loading on OneToMany and ManyToMany doesn't require weaving since
they can use a collection implementation, which is why they are lazy
by default and the others have to be set. Weaving can be done
statically or at runtime through a java agent as described:
http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Weaving
Best Regards,
Chris
Roger wrote:
On Thursday 24 September 2009 20:51:07 christopher delahunt wrote:
Hi Roger,
Is there a relationship between a child and its parent? Most of the
time, a parent will have a OneToMany with a child, and the child will
have a ManyToOne relationship back. Mark the @ManyToOne
relationship as
lazy - as well as all other relationships that you might not want to
always load.
Hi Chris
The parent is mapped OneToMany with the child and the child is mapped
ManyToOne with t he parent. The child ManyToOne relationship is also
mapped as LAZY. This works fine when I'm processing the Parent,
access to the Child happens only when requested. However, if I start
processing at the Child (i.e I don't retrieve the parent to get a
list of the children and process each child i.e I want to process
all Children of all Parents and I don't require any of the data held
at the Parent level, EclipseLink is generating an additional query to
retrieve the Parent. I've tried making the OneToMany link in the
parent lazy as well, but it doesn't seem to have any effect.
I hope that the above actually makes sense to everyone.
Regards
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users