Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to close entity manager/ DB connection / unit of work when EntityFetchGroup is used
How to close entity manager/ DB connection / unit of work when EntityFetchGroup is used [message #1769704] Wed, 02 August 2017 19:45 Go to next message
Pavel No is currently offline Pavel NoFriend
Messages: 47
Registered: May 2016
Member
As far as I know when I use EntityFetchGroup then although I close entity manager there is anyway a live `session` which is used if I try to get field, that has not been loaded yet. This is a feature of EclipseLink.

I use RMI and send objects from RMI server to RMI client. So, I am sure that I will not call getters of the fields that haven't been loaded. Besides I get exception when trying to send such object from server to client.

    java.lang.ClassNotFoundException: org.eclipse.persistence.internal.queries.EntityFetchGroup (no security manager: RMI class loader disabled)


When on server side I print all the fields of the entity (using reflection) I get the following:

   ....
    serialVersionUID=-2206365705176844178
    _persistence_primaryKey=+++F0HwHRQK8OlJZobI3Kw
    _persistence_cacheKey=null
    _persistence_listener=AttributeChangeListener(null)
    _persistence_fetchGroup=EntityFetchGroup(){...}
    _persistence_shouldRefreshFetchGroup=false
    _persistence_session=UnitOfWork(
    	DatabaseAccessor(connected)
    	H2Platform)
    _persistence_relationshipInfo=null
    _persistence_href=null
    _persistence_links=null


So we see that entity has this additional fields that were added via weaving. Could anyone say the proper way to close all these additional objects that I could use before sending object to client?
Re: How to close entity manager/ DB connection / unit of work when EntityFetchGroup is used [message #1769810 is a reply to message #1769704] Thu, 03 August 2017 14:56 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
You don't need to close them before sending; they are tied to the context which isn't sent along when the object is serialized, so when untriggered fields are remotely accessed it will result in an exception.

Best Regards,
Chris
Previous Topic:The import org.eclipse.persistence.annotations.OptimisticLocking cannot be resolved
Next Topic:Can fetch size be made to propagate to subqueries made for BatchFetchType.JOIN
Goto Forum:
  


Current Time: Thu Apr 25 06:44:27 GMT 2024

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

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

Back to the top