2 Replies Latest reply on Dec 13, 2006 8:30 AM by darren hartford

    History Interceptor

    darren hartford Expert

      Hey all,
      I would like to, for each entity bean, create a History entity bean to track all changes and timestamp of those changes.

      Searching across the web, I saw a user on the hibernate forum posted this interceptor:
      http://www.hibernate.org/195.html

      Does there already exist an EJB3 equivalent following the EJB3 interceptors, or is there a better approach (preferably non-vendor specific if possible)?

      Thanks,
      -D

        • 1. Re: History Interceptor
          J-C jc Apprentice

          Hi,

          I've tried to implement that in ejb3. I had some problem with some specific cases such as array.
          Moreover, with this approach I was quite anxious with the impact on the performance of my application.

          I stopped to look at that ... but I'm still interesting with that subject.

          Other approach may be to use DB trigger but that's DB specific and problem is to get the user that perform the change.

          • 2. Re: History Interceptor
            darren hartford Expert

            Hi jc,
            I have not thought about the array scenario...I would imagine that if it is in a relation with another table/entity and both marked for History, it would somehow handle both scenarios.


            I know the previous 'Audit' implementation and the 'History' implementation from hibernate both follow a logging approach of just what has changed. I was looking for a more detailed 'History' so that you could get the state of the data during a specific time.

            *particularly useful for applications with, say, Jboss Rules and testing retroactive changes.
            *Although logging is more efficient space-wise, researching the 'state' of the data during a specific time is more processor and labor efficient if captured in its full state. However, if a mechism was in place to retrieve the entire entity state from just the logged changes, that would be wonderful.

            I would be interested in feedback and comments.

            not very interesting example:

            Address
            clientId|street|city|state|zip|timestamp
            32|44 roy drive apt 2|bumsville|ZZ|99999|apr 06
            
            AddressHistory
            autoId|clientId|street|city|state|zip|timestamp
            1|32|345 summerville road|bumsville|ZZ|99999|jan 04
            2|32|44 roy drive apt 1|bumsville|ZZ|99999|feb 06