您的位置:首页 > 其它

Hibernate sessionFactory相关xml设置

2013-06-19 20:08 169 查看
<!-- Enable Hibernate's automatic session context management -->

<property name="current_session_context_class">thread</property>

打开自动线程管理。

What does
sessionFactory.getCurrentSession()
do? First, you can call it as many times and anywhere you like once you get hold of your
org.hibernate.SessionFactory
.
The
getCurrentSession()
method always returns the "current" unit of work. Remember that we switched the configuration option for this mechanism to "thread" in our
src/main/resources/hibernate.cfg.xml
?
Due to that setting, the context of a current unit of work is bound to the current Java thread that executes the application.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: