2 Replies Latest reply on Jun 18, 2006 5:25 AM by goeh

    Audit implementation

    jc7442

      Hi,

      I try to implement an audit based on my entity. The problem is that I should save the date of each modification but also mark the data that has been changed.

      I try to use @preUdate and @prePersist annotations.

      For the moment my solution (and I'm not very happy with it) is to use
      @PostLoad to save in a transient map the list of attribute that I want to audit and to check in @PreUdate what has changed between my map and the entity. It is probably a bad solution concerning the FecthType.LAZY.

      Is it possible to get a list of Field that have been updated ?. I suppose that hibernate need that kind of information to know what has to be persisted.
      Any suggestions are welcome ...

        • 1. Re: Audit implementation
          epbernard

          I'll provide that as an Hib extension, but I don't think It will be part of the spec

          • 2. Re: Audit implementation
            goeh

            What is the current status on auditing?
            Right now I need to implement an audit feature that triggers when a selection of properties changes.
            Should I also go the transient map way, or is there a Hibernate extension I can use now?
            What is best practice right now?
            (I'm using the latest and greatest of jboss 4.0.4 and seam 1.0)