从JPA的entityManagerFactory获取Hibernate SessionFactory [英] Get Hibernate SessionFactory from JPA's entityManagerFactory

查看:310
本文介绍了从JPA的entityManagerFactory获取Hibernate SessionFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个hibernate的特定功能,即StatelessSession,为此我需要Hibernate的SessionFactory。问题是我只有entityManagerFactory。如何在这种情况下获得一个StatelessSession?

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 get a StatelessSession in this scenario?

推荐答案

我通过注入它来解决它,像这样定义bean http:// docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/orm.html#orm-session-factory-setup

I solved it by injecting it, defining the bean like this http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/orm.html#orm-session-factory-setup

这篇关于从JPA的entityManagerFactory获取Hibernate SessionFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆