Announcement Announcement Module
No announcement yet.
Hibernate session in custom interceptor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • jandrla
    started a topic Hibernate session in custom interceptor

    Hibernate session in custom interceptor

    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:
    public void resolveNextState(Document document, ActionType action)
    , for managing statuses.

    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.

  • jandrla
    Hi Andrei,
    thanks for the link for this article:

    I was thinking about Hibernate Interceptor but I need to store also information about user action which cause changing of document status, which is argument of service method call. In Hibernate Inteceptor I can only examin object which is persistent.

    Am I right?

    Thanks again.
    Last edited by jandrla; Oct 3rd, 2007, 05:56 PM.

    Leave a comment:

  • Andrei Stefan
    Have you thought using Hibernate interceptors ?

    Leave a comment: