1. jpa-spec
  2. JPA_SPEC-43

Allow type level annotations to be used as meta-annotations


    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.2
    • Labels:


      I repeatedly find myself annotating my JPA entities with the very same set of annotations:

      class Person {

      If both @Entity and @EntityListener were allowed to be used as meta-annotations I could collapse them into:

      @interface @AuditedEntity {

      Resulting in:

      class Person {

      This is in line with the meta-annotation handling CDI exposes to introduce annotation with richer semantics in annotation code. The following changes would be required.

      • Add ElementType.ANNOTATION_TYPE to the relevant annotations
      • Specify that persistence providers have to evaluate the annotations from the meta-level as well using the first one found, so that locally defined annotations would be considered first.

        Issue Links


          Oliver Gierke created issue -
          ldemichiel made changes -
          Field Original Value New Value
          Assignee ldemichiel [ ldemichiel ]
          ldemichiel made changes -
          Tags metatypes JavaEE
          Lukas Jungmann made changes -
          Fix Version/s 2.2 [ 17400 ]
          Lukas Jungmann made changes -
          Assignee ldemichiel [ ldemichiel ] Lukas Jungmann [ jungicz ]
          Lukas Jungmann made changes -
          Link This issue is duplicated by JPA_SPEC-98 [ JPA_SPEC-98 ]


            • Assignee:
              Lukas Jungmann
              Oliver Gierke
            • Votes:
              4 Vote for this issue
              3 Start watching this issue


              • Created: