[jira] [Updated] (JDO-761) Add TCK test running sample queries from the spec

2017-08-01 Thread Michael Bouschen (JIRA)

 [ 
https://issues.apache.org/jira/browse/JDO-761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Bouschen updated JDO-761:
-
Attachment: JDO-761-patch4.txt

New patch JDO-761-patch4.txt implemeting new test methods testQueryxxe running 
the named query version of the sample query. 

> Add TCK test running sample queries from the spec
> -
>
> Key: JDO-761
> URL: https://issues.apache.org/jira/browse/JDO-761
> Project: JDO
>  Issue Type: Task
>  Components: tck
>Affects Versions: JDO 3.1
>Reporter: Michael Bouschen
>Assignee: Michael Bouschen
>Priority: Critical
> Fix For: JDO 3.2
>
> Attachments: JDO-761-patch2.txt, JDO-761-patch3.txt, 
> JDO-761-patch4.txt, JDO-761-patch.txt
>
>
> Chapter "14.10 Examples" of the JDO specification includes 20  sample 
> queries. There should be a TCK test class running these queries to make sure 
> the queries are correct.



--
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)