Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » lazy loading vs detached objects(lazy loading vs detached objects)
lazy loading vs detached objects [message #1837319] Wed, 27 January 2021 07:59 Go to next message
Eclipse UserFriend
Hi,

I'm using eclipselink version 2.7.7 where it is used in the JPA implementation in payara version 5.2020.7.

I'm using an EJB to retrieve an entity A which has a collection with sub entities B which are lazy loaded.

All works great, from the logs I could verify that entity A is queried but B is not. When I access the B entity (through A) inside the EJB B is queried as well.

Now I would expect that when do not access B and return A from the EJB to the caller that B is not accessible anymore.

But it seems eclipselink has (a very nice I must say) feature that when B is accessed a new connection to the db is opened and B is queried. This is very convenient don't get me wrong and I am very happy with it.

The point is however I have not been able to find documentation on the website (https://www.eclipse.org/eclipselink/documentation/) where this is described. But thats probably me not being thorough enough :)

Can you point me to the documentation where this is described?
Re: lazy loading vs detached objects [message #1837338 is a reply to message #1837319] Wed, 27 January 2021 15:20 Go to previous messageGo to next message
Eclipse UserFriend
I don't think you missed anything. The functionality you refer to is just something that was in TopLink's first lazy/indirect accessors implementation - it is just the way it works, and has worked for so long, that it wasn't treated as anything special. The instances being read in keep tabs on the context used to read them in, and so as long as that is available (if the EMF isn't closed or lost due to serialization), it can be used to get at the lazy data. There are a number of threads touching on it though, as it is a different from how other JPA implementations operate, which have some users expecting exceptions.
Re: lazy loading vs detached objects [message #1837431 is a reply to message #1837338] Fri, 29 January 2021 13:36 Go to previous message
Eclipse UserFriend
Hi,

Thank you for your response.

As you said, because other JPA implementations do it differently I would expect some documentation about it.

My issue is that if this functionality is not clearly documented I'm reluctant to start using it in production as for me it feels a bit like an unsupported mechanism.

gr. Hans
Previous Topic:Session-specific eclipselink.jdbc.batch-writing.size
Next Topic:EclipseLink DataModifyQuery does not throw fatal exception
Goto Forum:
  


Current Time: Fri Nov 07 23:41:30 EST 2025

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

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

Back to the top