67,513
社区成员
发帖
与我相关
我的任务
分享
package com.ok.csv.dao.hibernate;
@SuppressWarnings("unchecked")
public T save(T object) {
Session sess = getSession();
return (T) sess.merge(object);
}
<tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="query*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:advisor advice-ref="txAdvice"
pointcut="execution(* com.ok.csv.dao.hibernate.*.*(..))" />
</aop:config>