[JPA_SPEC-43] Allow type level annotations to be used as meta-annotations Created: 17/Jan/13  Updated: 05/Apr/13

Status: Open
Project: jpa-spec
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Oliver Gierke Assignee: ldemichiel
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: JavaEE, metatypes


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.

Comment by ldemichiel [ 18/Jan/13 ]

Support for this functionality is on our roadmap for Java EE 8. We should revisit this issue at that time.

Generated at Wed Mar 04 12:45:04 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.