• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London

Use of @Transactional at Service layer or DAO layer or both in case DAO has nested method calls

Ranch Hand
Posts: 39
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I have a service class from where I am calling method A in DAO. I am using Jdbc Template for all database operations. I have put an @Transactional at service layer at method level. Now, in DAO, method A is calling method B. In B, I am both inserting and updating records in database. Insert works fine but update throws an exception. Still I could see that inserted entry in table. My questions are -

1) Why data got committed in the method that threw exception?
2) Should a rollback not have happened if an exception had occurred at method B?
3) Do I need to use @Transactional at both service and DAO layers? - I tried to do it but got same result.


    Bookmark Topic Watch Topic
  • New Topic