Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Mapping Question

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


Back to the top