Skip to main content

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 Go to next message
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"
		<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"/>
		<property name="persistenceUnitName" value="poi"/>
		<property name="jpaDialect" ref="customJpaDialect"/>


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

	<!-- 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" class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager" ref="AtomikosTransactionManager" />
		<property name="userTransaction" ref="AtomikosUserTransaction" />

The persistence.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    <persistence-unit name="poi" transaction-type="JTA">
            <property name="eclipselink.weaving" value="static"/>

            <property name="eclipselink.logging.level" value="FINEST"/>

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
[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:[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
[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
Re: Eclipselink with JTA [message #1787273 is a reply to message #1750965] Wed, 23 May 2018 04:12 Go to previous message
veerakumar Yenamadala is currently offline veerakumar YenamadalaFriend
Messages: 1
Registered: May 2018
Junior Member
Hi, i am trying to achieve the same where i want JTA with EclipseLink in weblogic, are you able to fix the below issue. I saw some samples on Hibernate but not on EclipseLink.

Currently i am not sure what is the right way to get the transaction manager for distributed datasources..
Previous Topic:joinTransaction() opens transaction?
Next Topic:Rollback Behaviour When Commit Fails due to no connection
Goto Forum:

Current Time: Sun Dec 10 17:46:59 GMT 2023

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

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

Back to the top