Atomikos Community Forum

Not 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 to get help.

Upgrading from Hibernate 3 to Hibernate 4

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?

Vivekanand Alampally..
Vivekanand Alampally Send private email
Tuesday, July 10, 2012
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
Vivekanand Alampally Send private email
Tuesday, July 10, 2012
The same class as before, lookup did afaik not change.
Do you have any problems with this class?

Like documented here:

You should only remove the jta factory class, lookup class should be left untouched.
Torsten Krah Send private email
Wednesday, July 11, 2012
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.
Vivekanand Alampally Send private email
Wednesday, July 11, 2012
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.

Pascal Leclercq Send private email
Monday, August 20, 2012
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=""

    <context:property-placeholder local-override="true" location="" />
    <context:component-scan base-package="******************************************" />
    <context:annotation-config />
    <bean id="entityManager"
        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" />
        <property name="jpaProperties">
                <!-- 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="">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>
    <!-- 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" />
            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}" />

    <!--  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" />

    <!--  Also use Atomikos UserTransactionImp, needed to configure Spring  -->
    <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
        <property name="transactionTimeout" value="300" />

    <!--  Configure the Spring framework to use JTA transactions from Atomikos  -->
    <bean id="transactionManager"
        <property name="transactionManager" ref="atomikosTransactionManager" />
        <property name="userTransaction" ref="atomikosUserTransaction" />
    <!-- use declarative transaction management  -->
    <tx:annotation-driven  transaction-manager="transactionManager"/>
Serafim Tanev Send private email
Thursday, August 23, 2012

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz