• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring transaction setting

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic