Skip to main content

[jpa-spec issues] [JIRA] Created: (JPA_SPEC-43) Allow type level annotations to be used as meta-annotations

  • From: "Oliver Gierke (JIRA)" < >
  • To:
  • Subject: [jpa-spec issues] [JIRA] Created: (JPA_SPEC-43) Allow type level annotations to be used as meta-annotations
  • Date: Thu, 17 Jan 2013 20:15:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated

Allow type level annotations to be used as meta-annotations
-----------------------------------------------------------

                 Key: JPA_SPEC-43
                 URL: http://java.net/jira/browse/JPA_SPEC-43
             Project: jpa-spec
          Issue Type: Improvement
            Reporter: Oliver Gierke


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

{code:java}
@Entity
@EntityListeners(AuditingEntityListener.class)
class Person {

}
{code}

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

{code:java}
@Target(TYPE)
@Retention(RUNTIME)
@Entity
@EntityListeners(AuditingEntityListener.class)
@interface @AuditedEntity {

}
{code}

Resulting in:

{code:java}
@AuditedEntity
class Person {

}
{code}

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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[jpa-spec issues] [JIRA] Created: (JPA_SPEC-43) Allow type level annotations to be used as meta-annotations

Oliver Gierke (JIRA) 01/17/2013

[jpa-spec issues] [JIRA] Commented: (JPA_SPEC-43) Allow type level annotations to be used as meta-annotations

ldemichiel (JIRA) 01/18/2013
 
 
Close
loading
Please Confirm
Close