dilip patidar

Greenhorn
+ Follow
since Mar 10, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by dilip patidar

Thanks Roger Sterling

We are not using XA transaction yet.
we have also tried driver to MS driver instead of jtds jdbc driver.
10 years ago
using transaction annotation conf.
<tx:annotation-driven transaction-manager="transactionManager"/>
10 years ago
I am using spring data, with ms sql DB.
I am inserting the data into 2 table using the @Transactional annotation.
Calling 2 services from the single method for insertion in to 2(customer and address) tables.
In first service call data is getting commit in to customer table event though the another service call(address insertion call) is getting failed due to some exception.

logs as follows:-

EBUG - AbstractFlushingEventListener.logFlushResults(118) | Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
DEBUG - AbstractFlushingEventListener.logFlushResults(125) | Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
DEBUG - EntityPrinter.toString(114) | Listing entities:
DEBUG - EntityPrinter.toString(121) | customer{telephone1=212-752-1000, ext. 230, countryName=null, processKey=null, processStatus=0.........}
DEBUG - JdbcTransaction.doCommit(113) | committed JDBC Connection
DEBUG - JpaTransactionManager.doCleanupAfterCompletion(594) | Closing JPA EntityManager [org.hibernate.ejb.EntityManagerImpl@44581ea2] after transaction
DEBUG - EntityManagerFactoryUtils.closeEntityManager(338) | Closing JPA EntityManager
DEBUG - LogicalConnectionImpl.releaseConnection(232) | Releasing JDBC connection
DEBUG - LogicalConnectionImpl.releaseConnection(250) | Released JDBC connection
DEBUG - AbstractPlatformTransactionManager.cleanupAfterCompletion(1013) | Resuming suspended transaction after completion of inner transaction
DEBUG - AbstractBeanFactory.doGetBean(246) | Returning cached instance of singleton bean 'transactionManager'
DEBUG - AbstractPlatformTransactionManager.getTransaction(366) | Creating new transaction with name [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]: PROPAGATION_REQUIRED_NEW,ISOLATION_DEFAULT; ''
DEBUG - JpaTransactionManager.doBegin(369) | Opened new EntityManager [org.hibernate.ejb.EntityManagerImpl@53c7378f] for JPA transaction
DEBUG - AbstractTransactionImpl.begin(158) | begin
DEBUG - LogicalConnectionImpl.obtainConnection(212) | Obtaining JDBC connection
DEBUG - LogicalConnectionImpl.obtainConnection(218) | Obtained JDBC connection
DEBUG - JdbcTransaction.doBegin(69) | initial autocommit status: false
DEBUG - JpaTransactionManager.doBegin(408) | Not exposing JPA transaction [org.hibernate.ejb.EntityManagerImpl@53c7378f] as JDBC transaction because JpaDialect [org.springframework.orm.jpa.DefaultJpaDialect@6b04d3c8] does not support JDBC Connection retrieval
DEBUG - ActionQueue.addResolvedEntityInsertAction(213) | Executing identity-insert immediately
DEBUG - SqlExceptionHelper.logExceptions(139) | could not execute statement [n/a]


Using following configuration in method which is calling 2 services.

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public void transferData(Customer cutomer) {
custService.saveCutomer(customer);
addressService.addAddress(customer)

}

and my applicationContext configuration is.

<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="persistenceUnit"/>
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="com..."/>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName" value="${gpIntDatabase.driverClassName}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="true"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="1800000"/>
<property name="numTestsPerEvictionRun" value="3"/>
<property name="minEvictableIdleTimeMillis" value="1800000"/>
<property name="validationQuery" value="SELECT 1"/>
</bean>

Any help would be appreciated.
Thanks in advance






10 years ago