3 Replies Latest reply on Sep 1, 2005 5:28 PM by Emmanuel Bernard

    Customising EntityListener Annotation

    Simon Kitching Newbie

      I have an EntityListener that I wish to apply to quite a few entity classes to do standard auditing/logging of database changes.

      Rather than do

       @EntityListener("example.Auditor")
       class User {...}
      

      I would like to create a specialisation of EntityListener to do:
       @Audited
       class User {...}
      

      while having exactly the same effect (@postpersist etc. get called on the example.Auditor class).

      However from my (shaky) knowledge of annotations I can't do:
       public @interface Audited extends EntityListener {
       public String value() default "example.Auditor";
       }
      


      Is there any other way to create a custom annotation that JBoss will recognise as being equivalent to EntityListener?

      Thanks