use of org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI in project tomee by apache.
the class JpaCmpEngine method registerListener.
private synchronized void registerListener(final EntityManager entityManager) {
if (entityManager instanceof OpenJPAEntityManagerSPI) {
final OpenJPAEntityManagerSPI openjpaEM = (OpenJPAEntityManagerSPI) entityManager;
final OpenJPAEntityManagerFactorySPI openjpaEMF = (OpenJPAEntityManagerFactorySPI) openjpaEM.getEntityManagerFactory();
if (entityManagerListener == null) {
entityManagerListener = new OpenJPALifecycleListener();
}
openjpaEMF.addLifecycleListener(entityManagerListener, (Class[]) null);
return;
}
final Object delegate = entityManager.getDelegate();
if (delegate != entityManager && delegate instanceof EntityManager) {
registerListener((EntityManager) delegate);
}
}
Aggregations