hibernate事务模板

 
<bean id="transactionManager"   class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
 <ref bean="sessionFactory" />
    </property>
</bean>

<bean id="proxyInterceptor"  class="org.springframework.transaction.interceptor.TransactionInterceptor">
    <property name="transactionManager">
 <ref bean="transactionManager" />
    </property>

    <property name="transactionAttributes">
      <props>
 <prop key="*">PROPAGATION_REQUIRED</prop>
 <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
 <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
      </props>
    </property>
</bean>

 
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">

   <property name="interceptorNames">
 <value>proxyInterceptor</value>
   </property>
   <property name="beanNames">
 <list>
   <value>Service bean id</value>
 </list>
   </property>
</bean>

阅读更多
文章标签: hibernate bean class
个人分类: java
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭