With normal JDO or JPA usage you may have annotated a class like this
@Entity @DatastoreId public class Person { ... }
So we have a class that is JPA persistable, and is using the DataNucleus “datastore-identity” extension, providing a surrogate identity column in the datastore. This is fine, and easy enough. But what if you needed to put these 2 annotations on many classes? It would be simpler if you could define your own “composite” annotation that provided them more concisely. This is where we introduce meta-annotations.
If we define our own annotation like this
@Target(TYPE)
@Retention(RUNTIME)
@Entity
@DatastoreId
public @interface DatastoreIdEntity {}
You see that this annotation @DatastoreIdEntity provides both of our normal JPA annotations. So we can now annotate our JPA class like this
@DatastoreIdEntity public class Person { ... }
Much simpler!
You can do the same thing with JDO annotations, as well as for annotations on fields/methods.
Note that this is new in DataNucleus v5.1, and to use the field/method level JDO/JPA annotations you will have to use updated (javax.) API jars, that will be provided with v5.1