def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); tstatus = transactionManager.getTransaction(def); 我如果使用spring的platformtransaction接口来处理事务。是不是每个server类中都要加入上述代码啊,有没有简洁点的写法呢?
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); tstatus = transactionManager.getTransaction(def); 我如果使用spring的platformtransaction接口来处理事务。是不是每个server类中都要加入上述代码啊,有没有简洁点的写法呢?
解决方案 »
- java中md5加密实现原理?
- 为什么可以编译,却不能执行?
- test title
- java socket 和 VB scoket之间通讯的问题
- hibernate查询问题
- JBOSS 配置MSSQL数据源及使用
- 用一段时间hibernate就抛出这样的异常!
- 请问哪个组件类似于JTabbedpane的功能,但不要上面的标签页?急!!!
- 寻求使用jfreechart控件web上画图,应用当中使用xml得设计思路?
- spring3.1整合hibernate4 注入报空指针异常
- 菜鸟问题之struts基础问题:checkbox多值如何赋予Form类中的ArrayList?
- getHibernateTemplate()总是空怎么办
因为我用的jboss数据源。配置时总是提示第一个bean id not bound错误。加上<use-java-context> false也不行。
我就是在配置文件中引入事务管理内容时出错啊。我jndi用的是jboss的数据源,
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"><!-- Ttransaction Manage -->
<bean id="transationManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- txAdvice 你要拦截的方法名称 -->
<tx:advice id="txAdice" transaction-manager="transationManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- Config -->
<aop:config>
<aop:pointcut id="bizMethods" expression="execution(* org.standard.hr.biz.impl.*.*(..))"/>
<aop:advisor advice-ref="txAdice" pointcut-ref="bizMethods"/>
</aop:config>
</beans>
//execution(* org.standard.hr.biz.impl.*.*(..))" 拦截org.standard.hr.biz.impl下面的所有类、所有方法、(..)所有变量