Atomikos Forum |
|
We are trying to setup a new JTA transaction configuration for our new project. This project make use of spring JPA and spring Data with atomikos JTA transaction manager.
We configured our xmls as we saw in one of the atomikos tutorials. Currently we managed to startup our server with no error. Problem is when we try to persist an entity with the jpaRepository within a @Transactional service, our logs shows that the atomikos jta tranascion is taking place and commit succues. But our DB shows now new entry in the table. We had similar issue before when 2 beans scanned the same packages and resulting with "psuedo persist" effect like above. here is our xml: <bean class="org.springframework.orm.jpa.support.Persist enceAnnotationBeanPostProcessor" /> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /> <bean id="AtomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionMana ger" init-method="init" destroy-method="close"> <property name="forceShutdown" value="false" /> </bean> <bean id="AtomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" > <property name="transactionTimeout" value="300" /> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager" depends-on="AtomikosTransactionManager,AtomikosUserTransac tion"> <property name="transactionManager" ref="AtomikosTransactionManager" /> <property name="userTransaction" ref="AtomikosUserTransaction" /> <property name="allowCustomIsolationLevels" value="true" /> </bean> <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName" value="DataSource" /> <property name="xaDataSource" ref="dataBase" /> <property name="poolSize" value="3" /> </bean> <bean id="dataBase" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSo urce" lazy-init="true"> <property name="pinGlobalTxToPhysicalConnection" value="true" /> <property name="url" value="mydb" /> <property name="user" value="user" /> <property name="password" value="password" /> </bean> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean"> <property name="packagesToScan" value="packages" /> <property name="jpaProperties"> <props> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.dialect">org.hibernate.dialect.MySQ L5Dialect</prop> </props> </property> <property name="dataSource" ref="dataSource" /> <property name="jpaDialect"> <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaDialect" /> </property> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter"> <property name="database" value="MYSQL" /> <!-- <property name="databasePlatform" value="${hibernate.dialect}"/> --> <property name="showSql" value="false" /> <property name="generateDdl" value="false" /> <!-- <property name="hibernate.connection.autocommit" value="false"/> --> </bean> </property> <property name="jpaPropertyMap"> <map> <entry key="hibernate.connection.autocommit" value="false" /> </map> </property> </bean> Any ideas what's wrong with this configuration file? P.S We think it got something to do with the entityManagerFactory which is not familiar with the atomikos transaction manager. Thanks!
I have similar kind of issue. The log shows a "Bike" object has been added, but no rows has inserted to the MySQL database. I wonder if you have the issue resolved. Thanks in advance.
2014-02-07 10:24:56,824 TRACE [org.hibernate.event.internal.AbstractSaveEventListener] - Transient instance of: com.jsfsample.model.Bike 2014-02-07 10:24:56,826 TRACE [org.hibernate.event.internal.DefaultMergeEventListener] - Merging transient instance 2014-02-07 10:24:56,830 TRACE [org.hibernate.event.internal.DefaultLoadEventListener] - Loading entity: [com.jsfsample.model.BikeCategory#1] 2014-02-07 10:24:56,830 TRACE [org.hibernate.event.internal.DefaultLoadEventListener] - Attempting to resolve: [com.jsfsample.model.BikeCategory#1] 2014-02-07 10:24:56,830 TRACE [org.hibernate.event.internal.DefaultLoadEventListener] - Resolved object in session cache: [com.jsfsample.model.BikeCategory#1] 2014-02-07 10:24:56,835 TRACE [org.hibernate.event.internal.AbstractSaveEventListener] - Saving [com.jsfsample.model.Bike#<null>] 2014-02-07 10:24:56,838 TRACE [org.hibernate.engine.spi.ActionQueue] - Adding an EntityIdentityInsertAction for [com.jsfsample.model.Bike] object 2014-02-07 10:24:56,841 TRACE [org.hibernate.engine.spi.ActionQueue] - Adding insert with no non-nullable, transient entities: [EntityIdentityInsertAction[com.jsfsample.model.Bike#<delayed:1>]] 2014-02-07 10:24:56,841 TRACE [org.hibernate.engine.spi.ActionQueue] - Adding resolved non-early insert action. 2014-02-07 10:24:56,844 TRACE [org.hibernate.action.internal.UnresolvedEntityInsertActions] - No unresolved entity inserts that depended on [[com.jsfsample.model.Bike#<delayed:1>]] 2014-02-07 10:24:56,845 TRACE [org.hibernate.action.internal.UnresolvedEntityInsertActions] - No entity insert actions have non-nullable, transient entity dependencies. 2014-02-07 10:24:56,845 TRACE [org.hibernate.internal.SessionImpl] - Closing session 2014-02-07 10:24:56,845 TRACE [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] - Closing JDBC container [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl@7db2ec76] 2014-02-07 10:24:56,845 TRACE [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] - Closing logical connection 2014-02-07 10:24:56,845 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] - Releasing JDBC connection 2014-02-07 10:24:56,845 INFO [com.atomikos.jdbc.AtomikosConnectionProxy] - atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@74effb5c: isClosed()... 2014-02-07 10:24:56,845 INFO [com.atomikos.jdbc.AtomikosConnectionProxy] - atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@74effb5c: calling getWarnings... 2014-02-07 10:24:56,845 INFO [com.atomikos.jdbc.AtomikosConnectionProxy] - atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@74effb5c: calling clearWarnings... 2014-02-07 10:24:56,845 INFO [com.atomikos.jdbc.AtomikosConnectionProxy] - atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@74effb5c: close()... 2014-02-07 10:24:56,845 INFO [com.atomikos.datasource.xa.XAResourceTransaction] - XAResource.end ( 3139322E3136382E312E35372E746D30303030323030303034:3139322E3136382E312E35372E746D32 , XAResource.TMSUCCESS ) on resource XADBMS represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@307b07a9 2014-02-07 10:24:56,846 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] - Released JDBC connection 2014-02-07 10:24:56,846 TRACE [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] - Logical connection closed |