Get Hibernate SessionFactory from JPA's entityManagerFactory

前端 未结 4 1211
攒了一身酷
攒了一身酷 2021-02-01 05:35

I need a specific feature of hibernate that is StatelessSession and for that I need Hibernate\'s SessionFactory. The problem is I only have the entityManagerFactory. How can I g

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 05:53

    Hibernate >= 4.3 supports JPA 2.1. So you can use EntityManagerFactory.unwrap like emf.unwrap(SessionFactory.class) there.

提交回复
热议问题