Is it necessary to create a hibernate.cfg.xml to use HibernateStatistics?

0

I found it nonsense, since hibernate settings are usually allocated in xml persistence.

Can you retrieve the sessionfactory only by using the hibernate settings allocated in persistence.xml? or do I need to replicate ORM settings to hibernate.cfg.xml?

    
asked by anonymous 28.02.2017 / 22:18

1 answer

1

From JPA 2.1 you can recover SessionFactory as follows:

SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
    
28.02.2017 / 22:24