简体   繁体   中英

Get EntityManager from Hibernate session

I have built my application on Hibernate, but now I need to get EntityManager for one third-party module.

Could you please give me some hints how to get JPA objects from Hibernate?

(in my case I have SessionFactory and need EntityManager)

I found this in Hibernate 5.2

 Session session = HibernateUtil.getSessionFactory().openSession();
 EntityManager em = session.getEntityManagerFactory().createEntityManager();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM