【发布时间】:2011-08-25 00:49:34
【问题描述】:
升级我的项目我在这里考虑交易。
好吧,问题是我不太确定我应该什么时候使用事务在 Spring 中进行 Hibernate 查询。
并不是说我完全不明白什么是交易,我想我知道,但是
我是否需要将交易用于 get* 类型的查询,只需设置 read-only 属性?
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<tx:method name="get*" read-only="true" />
<!-- other methods use the default transaction settings -->
<tx:method name="*" />
</tx:attributes>
</tx:advice>
这对get* 查询有效吗?
因为,就我而言,应该像CREATE、UPDATE、DELETE 和此类查询一样使用事务。
我在这里遗漏了什么吗?
【问题讨论】:
标签: java spring-3 spring-transactions hibernate3