JPA +休眠+自动提交 [英] JPA + Hibernate + autocommit

查看:209
本文介绍了JPA +休眠+自动提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么当我关闭JPA配置文件中的自动提交功能时,我得到了这个警告吗?

Does anybody know why I get this warning when I turn off the auto-commit in JPA configuration file?

使用此设置:

Using this setting :

<property name="hibernate.connection.autocommit" value="false"/>

会产生以下警告:

generates this warning :

2009-08-04 09:54:10,621 [main] WARN org.hibernate.ejb.Ejb3Configuration - hibernate.connection.autocommit = false break the EJB3 specification

这会如何打破EJB3规范?

How would this break EJB3 specification?

推荐答案

从EJB 3.0规范的第13.3.4节:

From section 13.3.4 of the EJB 3.0 specification:


企业bean的业务
方法,消息监听器方法,
商业方法拦截器方法,生命周期回调拦截器
方法或超时回调方法
不能使用任何资源管理器
特定的事务管理方法
会干扰
容器划分
交易界限。例如,
企业bean方法不得使用
java.sql.Connection接口的以下方法
:commit,
setAutoCommit 和回滚;或
javax.jms.Session接口的以下方法:commit和
回滚。

The enterprise bean’s business methods, message listener methods, business method interceptor methods,life cycle call back interceptor methods, or timeout callback method must not use any resource-manager specific transaction management methods that would interfere with the container’s demarcation of transaction boundaries. For example, the enterprise bean methods must not use the following methods of the java.sql.Connection interface:commit, setAutoCommit, and rollback; or the following methods of the javax.jms.Session interface:commit and rollback.

这篇关于JPA +休眠+自动提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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