mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
portable way to unwrap the session (#266)
This commit is contained in:
@@ -6,7 +6,6 @@ import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.ejb.EntityManagerImpl;
|
||||
import org.hibernate.stat.Statistics;
|
||||
|
||||
@Singleton
|
||||
@@ -72,8 +71,7 @@ public class MetricsBean {
|
||||
}
|
||||
|
||||
public String getCacheStats() {
|
||||
EntityManagerImpl impl = (EntityManagerImpl) em.getDelegate();
|
||||
Session session = impl.getSession();
|
||||
Session session = em.unwrap(Session.class);
|
||||
SessionFactory sessionFactory = session.getSessionFactory();
|
||||
Statistics statistics = sessionFactory.getStatistics();
|
||||
return statistics.toString();
|
||||
|
||||
Reference in New Issue
Block a user