I am trying to persist a simple entity using hibernate + spring + Weblogic JTATransaction Manager. But getting "Synchronization not registered error"
This happens with Hibernate 3.2.0
Here is the mapping that I am using:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@localhost:9101:abc"/>
<property name="username" value="xyz"/>
<property name="password" value="xyz"/>
</bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager" />
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="persistence" />
<property name="jpaDialect" ref="jpaDialect" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="generateDdl" value="true" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="connection.datasource">TestSource</prop>
<prop key="hibernate.transaction.flush_before_completion">true</prop>
<prop key="hibernate.transaction.auto_close_session">true</prop>
<prop key="hibernate.ejb.autodetection">none</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.ejb.transaction.JoinableCMTTransactionFactory</prop>
<prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</prop>
<prop key="hibernate.jndi.url">
t3://localhost:7001
</prop>
<prop key="hibernate.jndi.class">
weblogic.jndi.WLInitialContextFactory
</prop>
<prop key="hibernate.jta.UserTransaction">java:comp/UserTransaction</prop>
<prop key="hibernate.current_session_context_class">org.hibernate.context.JTASessionContext</prop>
</props>
</property>
</bean>
StackTrace:
2007-07-24 19:22:48,565 DEBUG org.springframework.orm.jpa.EntityManagerFactoryUtils [] - Opening JPA EntityManager
2007-07-24 19:22:48,596 DEBUG org.springframework.orm.jpa.EntityManagerFactoryUtils [] - Registering transaction synchronization for JPA EntityManager
2007-07-24 19:22:48,596 DEBUG org.springframework.transaction.support.TransactionSynchronizationManager [] - Bound value [org.springframework.orm.jpa.EntityManagerHolder@1e29b99] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@13e6226] to thread [assemblyListenerContainer-3]
2007-07-24 19:22:48,673 DEBUG org.hibernate.jdbc.JDBCContext [] - TransactionFactory reported no active transaction; Synchronization not registered
2007-07-24 19:22:48,673 DEBUG org.hibernate.impl.SessionImpl [] - opened session at timestamp: 11852851685
2007-07-24 19:22:48,673 DEBUG org.hibernate.jdbc.JDBCContext [] - TransactionFactory reported no active transaction; Synchronization not registered
2007-07-24 19:22:48,673 DEBUG org.hibernate.jdbc.JDBCContext [] - TransactionFactory reported no active transaction; Synchronization not registered
Appreciate your help!