首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring 配备 JTA

2012-10-08 
spring 配置 JTA环境JBOSS4 数据源名称为 MysqlDsjee:jndi-lookup iddataSource jndi-namejava:Mysq

spring 配置 JTA

环境JBOSS4 数据源名称为 MysqlDs

<jee:jndi-lookup id="dataSource" jndi-name="java:MysqlDs" />
?? ?<bean id="sessionFactory"
?? ??? ?/>
?? ??? ?</property>?? ?
?? ??? ?<property name="hibernateProperties">
?? ??? ??? ?<props>
?? ??? ??? ??? ?<prop key="hibernate.dialect">
?? ??? ??? ??? ??? ?${hibernate.dialect}
?? ??? ??? ??? ?</prop>
?? ??? ??? ??? ?<prop key="hibernate.show_sql">
?? ??? ??? ??? ??? ?${hibernate.show_sql}
?? ??? ??? ??? ?</prop>
?? ??? ??? ?</props>
?? ??? ?</property>
?? ??? ?<!-- 此种映射方式更好,也能读取jar中的映射文件 -->
?? ??? ?<property name="mappingLocations">
?? ??? ??? ?<list>
?? ??? ??? ??? ?<value>classpath:com/test/model/hbm/*.hbm.xml</value>?? ??? ??? ??? ??? ??? ??? ?
?? ??? ??? ?</list>
?? ??? ?</property>
?? ??? ?<!--
?? ??? ?<property name="mappingDirectoryLocations">
?? ??? ??? ?<list>
?? ??? ??? ??? ?<value>classpath:com/test/model/hbm/</value>?? ??? ??? ?
?? ??? ??? ?</list>
?? ??? ?</property>
?? ??? ? -->
?? ?</bean>
?? ?<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
?? ?<property name="userTransactionName">? <!-- 这里很重要-->
?? ??? ?<value>java:comp/UserTransaction</value> ?
?? ?</property> ?
?? ?</bean>

热点排行