if (reference.getProperty("org.apache.aries.jpa.proxy.factory") != null) {
return;
}
try {
EntityManager em = emf.createEntityManager();
SessionFactory sessionFactory = em.unwrap(Session.class).getSessionFactory();
final Statistics statistics = sessionFactory.getStatistics();
statistics.setStatisticsEnabled(true);
mbeanServer.registerMBean(getStatisticsMBean(statistics), getOName(reference));
} catch (Exception e) {
LOG.warn("Error publishing StatisticsMXBean" + e.getMessage(), e);