Spring managed transaction issue with Teradata

Database

Spring managed transaction issue with Teradata

In my application, hibernate transactions are managed by spring aop and uses Terdata as database.

THIS ISSUES IS SPECIFIC TO TERADATA AND THE SAME CODE WORKS FINE IN MYSQL.

There is one service class i.e. ServiceClass.

It has method called save which takes list of objects as parameters and checks whether it is modified or not by checking it with data from database.

After that it calls the DAO class which persist the data in database.

ServiceClass method's aop:


transaction-manager="transactionManager">





ServiceClass:

public void save(List testList) {
DAOClass daoClass;

boolean isUpdated = false ;
for (Test test : testList) {
Test testInDB = this.sessionFactory.getCurrentSession().get(
Test.class, test.getId());
if(! test.getName().equals(testIndDB)) {
isUpdated = true ;
break;
}

}

daoClass.save(testList);

if(isUpdated) {
// do some processing
}
}

DAOClass:

public void save(List testList) {

for (Test test : testList) {
try {
this.sessionFactory.getCurrentSession().saveOrUpda te(test);
session.flush();

} catch (HibernateException e) {
///
}

}

}

DAOClass method's aop:

transaction-manager="transactionManager">





Transaction management code:


pointcut="execution(* ServiceClass.*(..))" />

pointcut="execution(* DAOClass.*(..))" />


Here, when service class calls save method of DAO class, it starts in new transaction as mentioned above in AOP code..

The issue is service class reads object from database in one transaction and then it calls method which starts a new transaction to save data.
When it calls session.flush, the table gets locked and can't get accessed even from outside application and the application gets hanged.

If i put the code of saving data from DAO to service class then it works fine as because it is under same transaction.

Has any body face similar issue while using Hibernate with Teradata (with spring managed transaction) ?

Regards,

Chirag