Get Hibernate SessionFactory from JPA's entityManagerFactory

前端 未结 4 1134
攒了一身酷
攒了一身酷 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条回答
  •  -上瘾入骨i
    2021-02-01 05:40

    Try to cast EntityManagerFactory to HibernateEntityManagerFactory.

    Since EntityManagerFactory doesn't support unwrap() (unlike EntityManager), it seems to be the only way to achieve your goal.

提交回复
热议问题