Atomikos JTA for Hibernate3 博客分类: 技术 SpringHibernateJDBCMySQLthread
程序员文章站
2024-03-18 20:46:34
...
http://wiki.atomikos.org/bin/view.pl/Main/HibernateIntegration#With_Spring
http://www.hibernate.org/hib_docs/v3/reference/en/html/transactions.html#transactions-connection-release
经过多次试验, 下面的配置是最合适的 (OpenSessionInView Works fine)
jta.properties
xa datasource and jta transaction manager
hibernate2 不支持 Connection Release Mode 概念, 在使用 JTA + OpenSessionInView 时会出一些问题
http://www.hibernate.org/hib_docs/v3/reference/en/html/transactions.html#transactions-connection-release
经过多次试验, 下面的配置是最合适的 (OpenSessionInView Works fine)
jta.properties
com.atomikos.icatch.service = com.atomikos.icatch.standalone.UserTransactionServiceFactory #Do you want transaction logging to be enabled or not? #If set to false, then no logging overhead will be done #at the risk of losing data after restart or crash. #Note: this setting may be overridden depending on your license! com.atomikos.icatch.enable_logging = false com.atomikos.icatch.automatic_resource_registration = true
xa datasource and jta transaction manager
<bean id="system.datasource" class="com.atomikos.jdbc.SimpleDataSourceBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName"><value>XADBMS</value></property> <property name="xaDataSourceClassName"> <value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value> </property> <property name="xaDataSourceProperties"> <value>url=${jdbc.url};user=${jdbc.username};password=${jdbc.password};pinGlobalTxToPhysicalConnection=true</value> </property> <property name="exclusiveConnectionMode"><value>false</value></property> <property name="connectionPoolSize"><value>10</value></property> </bean> <bean id="system.sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="system.datasource"/> <property name="jtaTransactionManager" ref="atomikosTransactionManager" /> <property name="mappingDirectoryLocations"> <list> <value>classpath:/com/coheg/</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.query.substitutions">true ${boolean.true.value}, false ${boolean.false.value}, yes ${boolean.true.value}, no ${boolean.false.value}</prop> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.format_sql">true</prop> <!-- for jta compatilibility --> <prop key="current_session_context_class">jta</prop> <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop> <prop key="hibernate.connection.release_mode">after_statement</prop> </props> </property> </bean> <!-- Construct Atomikos UserTransactionManager, needed to configure Spring --> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <!-- when close is called, should we force transactions to terminate or not? --> <property name="forceShutdown"><value>true</value></property> </bean> <!-- Also use Atomikos UserTransactionImp, needed to configure Spring --> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout"><value>120000</value></property> </bean> <!-- Configure the Spring framework to use JTA transactions from Atomikos --> <bean id="system.platformTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager"><ref bean="atomikosTransactionManager" /></property> <property name="userTransaction"><ref bean="atomikosUserTransaction" /></property> </bean>
hibernate2 不支持 Connection Release Mode 概念, 在使用 JTA + OpenSessionInView 时会出一些问题
上一篇: 以太坊帐户 博客分类: 以太坊
推荐阅读
-
Atomikos JTA for Hibernate3 博客分类: 技术 SpringHibernateJDBCMySQLthread
-
分布式事务JTA之实践:Spring+ATOMIKOS参考 博客分类: springjta spring
-
分布式事务JTA之实践:Spring+ATOMIKOS参考 博客分类: springjta spring
-
Hibernate3保持数据到MySQL乱码问题 博客分类: Hibernate技术
-
Hibernate3 Annotation 博客分类: 开源技术 HibernateSpringEJBmavenXML
-
Hibernate3 Annotation 博客分类: 开源技术 HibernateSpringEJBmavenXML