Skip to main content

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

Hi

I have a series of entities representing a hierarchy. Entity1 has many Entity2 
which in turn has many Entity3 which in turn ... etc, etc.

Entity1 maps Entity2 with a @OneToMany and Entity2 maps to Entity1 with 
@ManyToOne and Fetch=FetchType.Lazy. This is repeated down the heirarchy.

So far, this has been working well since I'm usually starting at the top of 
the hierarchy until this afternoon when I was lumbered with one of those 
urgent, need it yesterday type of jobs. What I needed to do was to read 
through the entities that live at the bottom level of the hierarchy.  For each 
entity, EclipseLink walked up  the hierarchy (running with debug level 
logging) and terminated midway through the query with
no obvious error messages, so whether it ran out of DB Connections or memory I 
don't know. I tried adding fetch = FetchType.LAZY to the @OneToMany mappings 
with no effect.

Is there anything I can do to stop EclipseLInk doing this and only walking 
back up the hierarchy when I try to access the level above. In this particular 
instance all the data I need is in the bottom level entity,

Regards

 


Back to the top