剛開始自學SSH,從網上找的demo裡的配置文件裡事務管理有幾段不了解的地方,
在網上找不到,求熱心人解釋一下,最好稍微解釋細點,標頭和屬性還有每一段的作用。。謝謝!
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<aop:config>
<aop:pointcut id="bussinessService"
expression="execution(public * com.huake.service.*.*(..))" />
<aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="exists" read-only="true" />
<tx:method name="add*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 配置hibernate模版,利用sessionFactory獲取session -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 配置hibernate事務管理器-->
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 配置切面 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="exists" read-only="true" />
<tx:method name="add*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 配置切入點 -->
<aop:config>
<aop:pointcut id="bussinessService" expression="execution(public * com.huake.service.*.*(..))" />
<!-- 切入點用入通知中 -->
<aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" />
</aop:config>