• 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
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Starting a different transaction in the method through Spring

Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have this scenario where i need to audit certain operations and insert rows in some audit table.
So i have taken this approach, whenever the method A in class A is called which does that operation, i call my auditService's method B to insert the record in the audit table. Now, i have marked the propagation on method B as REQUIRES_NEW so that always a new transaction is created whenever the audit record is created.

I am able to successfully make it work but i was thinking is it possible to start the second transaction in a second thread so that the initial thread is not delayed in any way.
I could use the java.util.Timer API for it, but somehow something doesn't look right.

Any thoughts/suggestions please.

Thank you

Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic