Hi, my question is related to Hibernate, and I'm sorry if this is not right place for post.
DocumentLifeCycleService is responsible for managing lifecycle of Document and automatically changes status of Document based on previous status and user action. It has method:
, for managing statuses.
public void resolveNextState(Document document, ActionType action)
In order to keep track of all changes of document status we need to log all changes in some database table (info about new status, who made changes, when and what was the action). My idea was to create interceptor (implementing MethodInterceptor) which will intercept call to resolveNextState, catch status before calling method, catch the status after calling a method, compare it, and if status has changed to persist info in log table.
My question is: how to manage Hibernate session in this interceptor. By injecting it? Should I manually begin and end transaction in method call, because transactions are defined declaratively on service layer?
Thanks in advance. Regards.