SessionEventListener and Transactions

View: New views
2 Messages — Rating Filter:   Alert me  

SessionEventListener and Transactions

by fcalfo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm thinking of using the SessionEventListener to trigger logic that inserts auditing data into a generic auditing table.

If I invoke this logic from the postCalculateUnitOfWorkChangeSet event, will it operate within the same transaction as the entity that is being persisted is operating within?


Re: SessionEventListener and Transactions

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, if you use the event's session, it will be the UnitOfWork for the current transaction.


fcalfo wrote:
I'm thinking of using the SessionEventListener to trigger logic that inserts auditing data into a generic auditing table.

If I invoke this logic from the postCalculateUnitOfWorkChangeSet event, will it operate within the same transaction as the entity that is being persisted is operating within?