[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-11-07 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16243172#comment-16243172
 ] 

Craig L Russell commented on JDO-764:
-

clr% svn commit tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC 
tck/src/java/org/apache/jdo/tck/pc/compositeAnnotation
Adding 
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/DatastoreIdDiscriminatorClassNameInheritanceNew.java
Adding 
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/DatastoreIdDiscriminatorClassNameInheritanceSuperclass.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppDepartment.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppEmployee.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCAppPerson.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSCompany.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSDepartment.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSEmployee.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSFullTimeEmployee.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSInsurance.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSMeetingRoom.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSPartTimeEmployee.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSPerson.java
Sending
tck/src/java/org/apache/jdo/tck/pc/companyAnnotatedFC/FCDSProject.java
Adding tck/src/java/org/apache/jdo/tck/pc/compositeAnnotation
Adding 
tck/src/java/org/apache/jdo/tck/pc/compositeAnnotation/ApplicationIdDiscriminatorClassName.java
Transmitting file data ...done
Committing transaction...
Committed revision 1814545.



> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: duplicate-annotations.txt, jdo764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-08-04 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16115170#comment-16115170
 ] 

Craig L Russell commented on JDO-764:
-

The strategy for merging annotations can be simple, preserving your original 
support for real applications, as well as extending it to what I thought was a 
really good usability improvement.

When encountering an annotation for the first time, initialize all of the 
target DataNucleus metadata values with default values defined in the JDO 
annotations. When processing an annotation the first or subsequent time, only 
process a value if it is not the default value for the annotation. Something 
like:

if (!"".equals(pcAnnotation.table()) dnMetadata.table(pcAnnotation.table()));
if (!"".equals(pcAnnotation.catalog()) 
dnMetadata.catalog(pcAnnotation.catalog());
...

The only problem is a user error where they specify more than one non-default 
value. And that is where, sadly, "unpredictable" results come from.


> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-08-01 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16108464#comment-16108464
 ] 

Andy Jefferson commented on JDO-764:


Firstly, the only reason you can get duplicated annotations is through use of 
meta-annotations, and likely the Java compiler people never bothered adding a 
check for that because they never thought of it ... because they have a check 
for normal annotation usage, preventing multiple @PersistenceCapable (to 
protect people from themselves).

Secondly, an annotation has to have a value defined for every attribute. 
Consequently 
@PersistenceCapable(table="MY_TABLE")
@PersistenceCapable(detachable="true", identityType=IdentityType.DATASTORE)

means 
@javax.jdo.annotations.PersistenceCapable(schema=, extensions=[], 
objectIdClass=void, identityType=UNSPECIFIED, catalog=, detachable=, 
members=[], requiresExtent=, cacheable=true, embeddedOnly=, table=MY_TABLE, 
serializeRead=false)
@javax.jdo.annotations.PersistenceCapable(schema=, extensions=[], 
objectIdClass=void, identityType=DATASTORE, catalog=, detachable=true, 
members=[], requiresExtent=, cacheable=true, embeddedOnly=, table=, 
serializeRead=false)

and that means that there is no way of knowing if a user has specified 
something as some value (which may or may not be the same as the default) or it 
took the default. The only way you can process those as a result is to read in 
the first then read in the second. I see no plausible "merge" process ... which 
is presumably why people are prevented from doing this with normal annotations. 
But if you have some magic code to know what is specified by the user, then 
feel free to propose a pull request for DataNucleus. No, I don't like 
"unpredictable" results.

My use-case for requesting this feature is from people specifying annotations 
on real applications, wanting to reduce the amount of boiler plate code; 
merging does not come into their use-case.

> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-07-31 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16108151#comment-16108151
 ] 

Craig L Russell commented on JDO-764:
-

I think there is a problem if you do not support merging annotations, in all 
the annotations that take names of things and not defaults or behaviors.

In your example, @PersistenceCapable could not be used in a meta-annotation 
because the table= value could not be set elsewhere. 

My rationale for allowing multiple annotations is to support the test case 
usage, which is based on your example, @DatastorePersistable, which could only 
use the default table name strategy if @PersistenceCapable cannot be used twice.

On the implementation side, the DataNucleus code now catches multiple 
annotations and issues an error message. But it seems like it is just as easy 
to collect annotations and apply them to the DataNucleus metamodel. What is the 
harm in processing all such annotations that are applied to an element? The 
first time the DataNucleus metamodel encounters @PersistenceCapable it fills 
the metamodel with the values it finds. The next time it encounters 
@PersistenceCapable it fills the metamodel with additional values. The way the 
specification draft is written, it is undefined what happens if multiple 
annotations with conflicting values are processed, so there is no need to find 
out if this is the first or nth identical annotation. If the user has a 
conflict, results are unpredictable, as expected.




> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-07-27 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16103024#comment-16103024
 ] 

Andy Jefferson commented on JDO-764:


Why does the patch result in things like this

@PersistenceCapable(table="...")
@PersistenceCapable(detachable="true", identityType=IdentityType.DATASTORE)
@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, 
column="DATASTORE_IDENTITY")
@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME, 
column="DISCRIMINATOR", indexed="true")
@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
public class XXX {...}

You have duplicated @PersistenceCapable, so which will be used ? likely the 
first that is presented to the accessing code by Java. 
No "merging" will take place in DataNucleus code, because it should never 
expect such things. The proposal to support "meta-annotations" was not a 
proposal to support merging of duplicated annotations (with normal annotation 
usage you will never get duplications, so there is no basic requirement to 
support merging there)

> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-07-26 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16102479#comment-16102479
 ] 

Craig L Russell commented on JDO-764:
-

This is the proposed text for the specification. Please review.

•   Annotations can be combined and applied to user-defined compound 
annotations. A user-defined annotation itself can be annotated with one or more 
JDO annotations and when the user-defined annotation is applied to an element, 
all of its JDO annotations will be applied to that element. Nested user-defined 
annotations are also supported. If the same JDO annotations appear multiple 
times in user-defined annotations, all JDO annotation values will be applied to 
the target element. If the same JDO annotation value appears multiple times, 
results are undefined.

> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-07-11 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16082302#comment-16082302
 ] 

Craig L Russell commented on JDO-764:
-

The table name could be parameterized thus:

String TABLE_NAME = "persons";
@DatastoreIdDiscriminatorClassNameInheritanceNew

where @DatastoreIdDiscriminatorClassNameInheritanceNew is defined thus:

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@javax.jdo.annotations.PersistenceCapable(detachable="true", 
identityType=IdentityType.DATASTORE, table=TABLE_NAME)
@javax.jdo.annotations.Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
@javax.jdo.annotations.Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME, 
column="DISCRIMINATOR", indexed="true")
@javax.jdo.annotations.DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, 
column="DATASTORE_IDENTITY")

Without documentation, this might not be as good as having a separate 
annotation:
@PersistenceCapable(table="persons")


> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch, jdo-764.patch, JDO-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-07-05 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16075946#comment-16075946
 ] 

Craig L Russell commented on JDO-764:
-

The patch jdo-764.patch implements a test that compound annotations are usable. 
The compound annotation 
DatastoreIdDiscriminatorClassNameInheritanceNew combines annotations for
@javax.jdo.annotations.PersistenceCapable
@javax.jdo.annotations.Inheritance
@javax.jdo.annotations.Discriminator and
@javax.jdo.annotations.DatastoreIdentity

Other compound annotations will be used for different tests.

> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: jdo-764.patch, JDO-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> public @interface DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> public @interface MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-06-04 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16036379#comment-16036379
 ] 

Craig L Russell commented on JDO-764:
-

Do we have any test classes that could easily be adapted to test this 
capability? We could perhaps define these annotations as one and use in several 
places in the test cases:

@Target(TYPE)
@Retention(RUNTIME)
@PersistenceCapable(detachable="true", identityType="datastore", 
embeddedOnly="true")
@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME,
column="DISCRIMINATOR", indexed="true")
@DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, 
column="DATASTORE_IDENTITY")
@interface @DatastoreIdDiscriminatorPersistable { }

Then:

@PersistenceCapable(table="persons")
@DatastoreIdDiscriminatorPersistable
public class FCDSPerson 
implements IPerson, Serializable, Comparable, Comparator, DeepEquality  {

Here is additional text to be added to Chapter 19 of the specification. Please 
review, especially the terminology "compound annotations".

Annotations can be combined and applied to user-defined compound annotations. A 
user-defined annotation itself can be annotated with one or more JDO 
annotations and when the user-defined annotation is applied to an element, all 
of its JDO annotations will be applied to that element.


> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> @interface @DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> @interface @MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-06-01 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16032931#comment-16032931
 ] 

Andy Jefferson commented on JDO-764:


API updated with the patch. Spec updated to mirror the updates to the various 
annotations. 

Whether it needs any more than that in the spec is left for others to decide. 
For reference I added a block to the DataNucleus documentation at
http://www.datanucleus.org/products/accessplatform_5_0/jdo/annotations.html#meta_annotations
explaining about meta-annotations and that JDO annotations can be utilised.

> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> @interface @DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> @interface @MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-05-31 Thread Michael Bouschen (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16031986#comment-16031986
 ] 

Michael Bouschen commented on JDO-764:
--

+1

> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> @interface @DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> @interface @MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (JDO-764) Allow JDO annotations to be used in meta-annotations

2017-05-31 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16031822#comment-16031822
 ] 

Craig L Russell commented on JDO-764:
-

+1

This is a really excellent idea.

Get one more vote and check it in!


> Allow JDO annotations to be used in meta-annotations
> 
>
> Key: JDO-764
> URL: https://issues.apache.org/jira/browse/JDO-764
> Project: JDO
>  Issue Type: Improvement
>  Components: api, specification
>Affects Versions: JDO 3.1
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-764.patch
>
>
> By default annotations are used directly in a persistable class. Java 
> additionally allows annotations to be formed of other annotations. This is 
> particularly useful where a user has a particular combination of annotations 
> to set on a class/field/method and wants to simply annotate with an 
> abbreviated form. For example, specifying attributes of an annotation
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> or formed of multiple annotations
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> These can be represented as meta-annotations like this
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true", identityType="datastore", 
> embeddedOnly="true")
> @interface @DatastoreIdPersistable
> {
> }
> @Target(TYPE)
> @Retention(RUNTIME)
> @PersistenceCapable(detachable="true")
> @Extension(vendorName="datanucleus", key="multitenancy-column-name", 
> value="TENANT")
> @interface @MultitenantPersistable
> {
> }
> and the user can subsequently just annotate their persistable class as
> @DatastoreIdPersistable
> public class MyClass1 {...}
> @MultitenantPersistable
> public class MyClass2 {...}
> The work required to support this in the JDO spec is simply to update the 
> following annotations to add @Target({ElementType.ANNOTATION_TYPE})
> The annotations requiring this are
> @Element, @EmbeddedId, @Key, @NotPersistent, @Order, @Persistent, 
> @Serialized, @Transactional, and @Value  (all other annotations already have 
> @Target({ElementType.TYPE}) which already permits their usage in 
> meta-annotations.
> The same is proposed for JPA 2.2, see 
> https://github.com/javaee/jpa-spec/issues/43



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)