After exploring the EclipseLink source code I found that the objects stored in the persistence context are located in a maps called identityMaps for each entity class there is a map which stores all the objects of that type.
You can print the contents of the map using the following methods:
public interface IdentityMapAccessor {
/**
* PUBLIC:
* Used to print all the Objects in the identity map of the given Class type.
* The output of this method will be logged to this session's SessionLog at SEVERE level.
*/
public void printIdentityMap(Class theClass);
/**
* PUBLIC:
* Used to print all the Objects in every identity map in this session.
* The output of this method will be logged to this session's SessionLog at SEVERE level.
*/
public void printIdentityMaps();
}
Examples:
((JpaEntityManager) entityManager.getDelegate())
.getActiveSession()
.getIdentityMapAccessor()
.printIdentityMaps();
((JpaEntityManager) entityManager.getDelegate())
.getActiveSession()
.getIdentityMapAccessor()
.printIdentityMap(MyClass.class);
Regards,
Alfredo Osorio
http://www.sonrisaseventos.com/
[Updated on: Fri, 07 November 2014 22:05]
Report message to a moderator