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?