Announcement Announcement Module
Collapse
No announcement yet.
@Transactional with Aspect Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Transactional with Aspect

    Hi

    I am trying to figure out if any aspect invoked on a transactional service is included in the same transaction. I have a service implementation that has methods with @Transactional annotations.

    Now I want to include an Aspect that is going to log audit information to an audit table in the database whenever a service method is invoked. So, the sequence is:

    client (web layer) --> Spring Transaction infrastructure --> AuditAspect --> My Service implementation

    My question is: Will the database operations (insert into audit_table) be in the same transaction as the one that the service will be executed in, so that if the service fails and the transaction is rolled back, then the audit record is rolled back too, as if nothing happened. Or do I need to register a transaction synchronization within my aspect class to be notified of transaction commit so that I can insert the audit record only when the transaction has been committed?

    Thanks
    G. Patel
Working...
X