This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Spring transaction setting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring transaction setting" Watch "Spring transaction setting" New topic
Author

Spring transaction setting

Srinivas Ramgopal
Ranch Hand

Joined: Aug 06, 2006
Posts: 63
Hi all,

I am using Spring v2.x's HibernateTransactionManager to declare transactions using Hibernate v3.x.

I have the transaction setting as NOT_SUPPORTED on insert() on a DAO class. A row is being inserted into the database inspite of the above transaction setting.

Why is this so?
Do I need to explictly set the autocommit false?
Can some one explain the internal mechanism of spring's hibernateTransactionManager?

Below is the spring config file:


Any input is highly appreciated.

Thanks in advance for your time and interest.
Srinivas Ramgopal
Ranch Hand

Joined: Aug 06, 2006
Posts: 63
Hi all,

I found the fix for this problem.

I had to set the autocommit to false at the database level in the config file.

But I assumed that Spring's HibernateTransactionManager that manages the Hibernate session will take care of setting the autocommit to false but it seem not to be the case.

Thanks.
Halcon Guatemala
Ranch Hand

Joined: Sep 06, 2006
Posts: 57
sorry Srinivas, I'm a Spring+Hibernate, :roll: what do you mean with:

I had to set the autocommit to false at the database level in the config file.
?

Thanks in advance


"La verdadera sabidur´┐Ża viene del temor de Dios"
 
 
subject: Spring transaction setting
 
Similar Threads
spring 2 with hibernate 3
Hiberante transaction in Spring
Transaction is not rolling back in case of exception
Spring/Hibernate/Jboss/JTA/getCurrentSession()/createQuery is not valid without active transaction
Spring Transaction Management doesn't roll back my transaction