Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » hibernate gotchas
hibernate gotchas [message #715979] Tue, 16 August 2011 02:43 Go to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
I found this in a hibernate gotcha article and was wondering if the same applies to EclipseLink:

When mapping a relation as One-to-One or Many-to-One on the "One" side of the relation you can't have lazy loading unless you specify the field as not nullable.

Why is that?
Essentially on the many side of the relation hibernate can use collection proxies and lazily load instances when required.
On the "One" side there is no collection interface but instead a reference to one of your model classes.
Hibernate can proxy that one as well but only if it is sure the reference will never be null!

Tom
Re: hibernate gotchas [message #716095 is a reply to message #715979] Tue, 16 August 2011 08:54 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1017
Registered: July 2009
Senior Member
That is a Hibernate specific limitation.

EclipseLink uses weaving (static or dynamic) to allow lazy relationships, so they can be nullable, as described here:
http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#What_You_May_Need_to_Know_About_EclipseLink_JPA_Lazy_Loading

Best Regards,
Chris
Previous Topic:(no subject)
Next Topic:Howto log SQL with java.util.logging?
Goto Forum:
  


Current Time: Thu Aug 21 14:08:42 EDT 2014

Powered by FUDForum. Page generated in 0.02187 seconds