Atomikos Community ForumNot for product support. If you need urgent help with your project then buy development or production support or check the known problems... Only registered users can post (registration is free). Problems registering? Send an email to support@atomikos.com to get help. |
|
Hi All,
We recently upgraded from Hibernate 3 to Hibernate 4. We are using Spring 3.2.0 M1 with Hibernate. Initially we were setting Hibernate properties as <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory</prop> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> But after upgrading to Hibernate4, Can anyone here please tell me for the property "hibernate.transaction.manager_lookup_class" what corresponding class should I set? Thanks, Vivekanand Alampally..
Sorry, I missed some text in previous post,
In hibernate properties, initially we were setting propeties as <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory</prop> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> But after upgrading to Hibernate4, <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</prop> Can anyone here please tell me for the property "hibernate.transaction.manager_lookup_class" what class should I set? I posted this topic in official Spring & Hibernate forums http://forum.springsource.org/showthread.php?128268-Upgrading-for-Hibernate-3-to-Hibernate-4 https://forum.hibernate.org/viewtopic.php?f=1&t=1016892
The same class as before, lookup did afaik not change.
Do you have any problems with this class? Like documented here: http://www.atomikos.com/Documentation/HibernateIntegration#With_JPA You should only remove the jta factory class, lookup class should be left untouched.
Thanks Torsten Krah for your response,
After setting the property, <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> I am getting the following exception.. HHH000427: Using deprecated org.hibernate.transaction.TransactionManagerLookup strategy [hibernate.transaction.manager_lookup_class], use newer org.hibernate.service.jta.platform.spi.JtaPlatform strategy instead [hibernate.transaction.jta.platform] So, Can you please tell me, how to get rid of this exception.
Hi Vivekanand,
this is a warning not an exception. If hibernate handle the compatibity properly I suppose this should continue tu work To get rid message, I suppose we have to write our Impl of org.hibernate.service.jta.platform.spi.JtaPlatform. Regards
This is my full configuration with Hibernate 4. Works for my project. I hope this will help you.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <context:property-placeholder local-override="true" location="classpath:jdbc.properties" /> <context:component-scan base-package="******************************************" /> <context:annotation-config /> <bean id="entityManager" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:dataSource-ref="dataSource" p:persistenceXmlLocation="**/persistence-test.xml" p:persistenceUnitName="CentralDB" > <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="false" /> <property name="generateDdl" value="true" /> <property name="database" value="POSTGRESQL" /> </bean> </property> <property name="jpaProperties"> <props> <!-- BEGIN Atomikos --> <prop key="hibernate.transaction.factory_class">org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory</prop> <!-- The following line is what's used in Hibernate 4 instead of a TransactionManagerLookup class --> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> <!-- END Atomikos --> <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> <prop key="hibernate.connection.autocommit">false</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.use_sql_comments">false</prop> <prop key="hibernate.generate_statistics">false</prop> <prop key="hibernate.connection.release_mode">after_statement</prop> </props> </property> </bean> <!-- configure an Atomikos JTA-aware datasource --> <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName" value="XADBPG" /> <!-- property name="testQuery" value="select 1" /--> <property name="xaDataSource" ref="pgXADataSource" /> </bean> <!-- set the underlying driver class to use, in this example case we use Oracle --> <bean id="pgXADataSource" class="org.postgresql.xa.PGXADataSource"> <!-- set the driver-specific XADataSource properties (check your driver docs for more info) --> <property name="serverName" value="${serverName}" /> <property name="portNumber" value="${portNumber}" /> <property name="databaseName" value="${databaseName}" /> <property name="user" value="${username}" /> <property name="password" value="${password}" /> </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="false" /> <property name="transactionTimeout" value="300" /> </bean> <!-- Also use Atomikos UserTransactionImp, needed to configure Spring --> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout" value="300" /> </bean> <!-- Configure the Spring framework to use JTA transactions from Atomikos --> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="atomikosTransactionManager" /> <property name="userTransaction" ref="atomikosUserTransaction" /> </bean> <!-- use declarative transaction management --> <tx:annotation-driven transaction-manager="transactionManager"/> </beans> |
Powered by FogBugz

