Results 1 to 3 of 3

Thread: Hibernate session in custom interceptor

  1. #1
    Join Date
    Jul 2006
    Posts
    109

    Default 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:
    Code:
    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.

  2. #2
    Join Date
    Mar 2007
    Posts
    515

  3. #3
    Join Date
    Jul 2006
    Posts
    109

    Default

    Hi Andrei,
    thanks for the link for this article:
    http://hibernate.javabeat.net/articl...-introduction/

    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 at 04:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •