Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » hibernate gotchas
hibernate gotchas [message #715979] Tue, 16 August 2011 02:43 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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 Jul 03 16:06:16 EDT 2025

Powered by FUDForum. Page generated in 0.03549 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top