Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink with JTA(Eclipselink with JTA)
Eclipselink with JTA [message #1750965] Tue, 03 January 2017 06:33
Baqar Naqvi is currently offline Baqar NaqviFriend
Messages: 1
Registered: January 2017
Junior Member
I am trying to configure eclipse link with JTA. I am using a spring boot application with Atomikos for JTA over tomcat. However configuring the JTA does not result in the reflection of data over the database.

I have shared below the settings below in app-config.xml


	<!--Primary Entity Manager-->
	<bean id="entityManagerFactory"
		  class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
		  p:packagesToScan="com.services.poi.domain">
		<property name="persistenceXmlLocation" value="classpath:persistence.xml"/>
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
			<property name="showSql" value="true"/>
			<property name="generateDdl" value="false"/>
			<property name="databasePlatform" value="org.eclipse.persistence.platform.database.MySQLPlatform"/>
			</bean>
		</property>
		<property name="persistenceUnitName" value="poi"/>
		<property name="jpaDialect" ref="customJpaDialect"/>

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



The persistence.xml is as follows:


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
             xmlns=""
             xmlns:xsi=""
             xsi:schemaLocation="">
    <persistence-unit name="poi" transaction-type="JTA">
        <class>..</class>
        <jta-data-source>my_ds</jta-data-source>
        <properties>
            <property name="eclipselink.weaving" value="static"/>

            <property name="eclipselink.logging.level" value="FINEST"/>
        </properties>
    </persistence-unit>
</persistence>



The log traces look like as follows:

2017-01-03 11:28:31 [http-nio-8080-exec-4] INFO  c.a.i.imp.BaseTransactionManager - createCompositeTransaction ( 300000 ): created new ROOT transaction with id 192.168.0.131.tm0000200001
[EL Finer]: connection: 2017-01-03 11:28:31.29--ServerSession(2119418431)--Thread(Thread[http-nio-8080-exec-4,5,main])--client acquired: 1608526117
[EL Finer]: transaction: 2017-01-03 11:28:31.29--ClientSession(1608526117)--Thread(Thread[http-nio-8080-exec-4,5,main])--acquire unit of work: 353273644
[EL Finest]: transaction: 2017-01-03 11:28:31.291--UnitOfWork(353273644)--Thread(Thread[http-nio-8080-exec-4,5,main])--PERSIST operation called on: com.services.poi.domain.entity.PointOfInterest@3a9323f1[uuid=POI-E9B4HZ77AC,searchDisplayName=Test Development 9,searchComparisonName=Test Development 9,latitude=27.67,longitude=64.01,locationType=1,geoHash=tkvt2t4tmjug,moreDetails=,editableMoreDetails=0,cityId=7,fieldType=1,lastUpdated=2017-01-03 11:28:31.29,buildingName=test,area=test,streetAddress=test,lastUpdated=2017-01-03 11:28:31.29].
2017-01-03 11:28:31 [http-nio-8080-exec-4] INFO  c.a.i.imp.CompositeTransactionImp - commit() done (by application) of transaction 192.168.0.131.tm0000200001
[EL Finer]: transaction: 2017-01-03 11:28:31.372--UnitOfWork(353273644)--Thread(Thread[http-nio-8080-exec-4,5,main])--release unit of work
[EL Finer]: connection: 2017-01-03 11:28:31.372--ClientSession(1608526117)--Thread(Thread[http-nio-8080-exec-4,5,main])--client released
Previous Topic:Erro: Column name is being ignored
Next Topic:The DB2 platform/dialect is inefficient, out of date and inexact
Goto Forum:
  


Current Time: Mon Dec 18 09:19:30 GMT 2017

Powered by FUDForum. Page generated in 0.01477 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software