[jira] [Updated] (JDO-751) Support for Java8 Optional

2016-07-08 Thread JIRA

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

Tilmann Zäschke updated JDO-751:

Attachment: JDO-751-tck-patch-v6.txt

Added version 6 of the patch.

Tests for {{orElse()}} in {{WHERE}} clauses were removed because should should 
probably be an optional feature (it also still failed for dsid with DN 
5.0.1-SNAPSHOT from today).

The test for navigation through {{Optional}} references is still in place and 
is currently the last test that is failing.

> Support for Java8 Optional
> --
>
> Key: JDO-751
> URL: https://issues.apache.org/jira/browse/JDO-751
> Project: JDO
>  Issue Type: New Feature
>  Components: specification, tck
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-751-tck-patch-v5.txt, JDO-751-tck-patch-v6.txt
>
>
> java.util.Optional provides a feature that is available in other languages. 
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this 
> as a "supported persistable type"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Re: JIRA 747

2016-07-08 Thread Andy Jefferson
Hi Tilmann,

> (sorry for double posting, I sent this to an...@apache.org before)

I haven't used the Apache email for years since Apache gets loads of spam; I'd 
guess it goes to /dev/null on my ISP :-)

> I started looking into adapting datanucleus for JDO JIRA 747: 
> https://issues.apache.org/jira/browse/JDO-747
> 
> Some time ago you offered to give some initial pointers, could you tell 
> me where to start?
> 
> My first goal: Update datanuclues so that a PERSISTENT_NEW object 
> transitions to PERSISTENT_CLEAN when they are refreshed _and_ if there 
> is an object with the same ID in the database.

The first place to look is the StateManager, which is in "datanucleus-core" at 
https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/state/StateManagerImpl.java

The transition in Lifecycle states for JDO is controlled from 
"datanucleus-api-jdo", in this package
https://github.com/datanucleus/datanucleus-api-jdo/tree/master/src/main/java/org/datanucleus/api/jdo/state

I'd guess you need to look at class PersistentNew.java (the state the object is 
in) and look for a method transitionRefresh(), which looks like it uses the 
default implementation (do nothing) currently.


FYI DataNucleus JPA has an equivalent set of Lifecycle states over in 
"datanucleus-api-jpa", so if changing anything in the lifecycle states for JDO 
(in datanucleus-api-jdo) then this will not affect DataNucleus JPA usage (a 
good thing).


Beyond those, some other classes that you may need to be aware of are
ExecutionContext (does the work of the PM), here
https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/ExecutionContextImpl.java

Transaction (for the ExecutionContext)
https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/TransactionImpl.java



Hope that helps
-- 
Andy
DataNucleus (Web: http://www.datanucleus.org   Twitter: @datanucleus)


JIRA 747

2016-07-08 Thread Tilmann Zäschke

Hi Andy,

(sorry for double posting, I sent this to an...@apache.org before)

I started looking into adapting datanucleus for JDO JIRA 747: 
https://issues.apache.org/jira/browse/JDO-747


Some time ago you offered to give some initial pointers, could you tell 
me where to start?


My first goal: Update datanuclues so that a PERSISTENT_NEW object 
transitions to PERSISTENT_CLEAN when they are refreshed _and_ if there 
is an object with the same ID in the database.


I tried to find the state transition checks and triggers. I first looked 
into datanucleus' Transaction.commit(), but it seems to forward 
everything to an implementation of XAResource.commit, probably either 
one of the LocalXAResource or the EmulatedXAResource classes. These 
forward the call to a 'Connection', but I can't immediately see which 
implementation is used.


Could you give me some pointers?

Thanks,
Tilmann




Minutes: JDO TCK Conference Call Friday July 8, 9 AM Pacific Daylight Time (PDT)

2016-07-08 Thread Craig Russell
Attendees: Michael Bouschen, Tilmann Zäschke, Craig Russell

NOTE: We have a new video conference. Please disregard the previous one.

Next meeting will take place on Thursday June 15 at 9:00 PDT.

Agenda:

1. New patch on JDO-751 "Support for Java8 Optional" 
https://issues.apache.org/jira/browse/JDO-751

Discussion continues in the JIRA

Persistent Object Model 6.4.3
java.lang.Optional types
JDO implementations must support fields of type Optional where T is an 
Immutable Object Class types, java.util.Date, Enum types, or 
Persistence-capable Class types. They may be mapped nullable datastore types or 
to Optional types at the option of the JDO implementation.

When instantiating an instance from the datastore, the JDO implementation would 
get the value v from the datastore and assign the field f = 
Optional.ofNullable(v). When storing the field in the datastore, the 
persistence implementation would store the result of v = 
f.isPresent()?f.get():null.

Navigation in JDOQL via optional.optional seems to be an issue. It looks 
similar to navigating the Company model, e.g. WHERE this.manager.manager.name 
== ‘Michael’. AI: Michael try some experiments with queries and multiple 
navigations.

2. JDO 3.1: Need to go through change lists in JIRA for 3.1 RC1 and 3.1 to 
prepare JCP Change Log

3. Other issues

Action Items from weeks past:
[Oct 30 2015] AI Craig: File a maintenance review with JCP
[May 15 2015] AI Craig Spec change for roll back an active transaction when 
closing a persistence manager (JDO-735)  
[Apr 17 2015] AI Craig: Oracle spec page on JDO need to be updated once the JCP 
Maintenance Release for JDO 3.1 is published
[Oct 17 2014] AI Matthew any updates for "Modify specification to address NoSQL 
datastores": https://issues.apache.org/jira/browse/JDO-651?
[Feb 28 2014] AI Everyone: take a look at 
https://issues.apache.org/jira/browse/JDO-712
[Feb 28 2014] AI Everyone: take a look at 
https://issues.apache.org/jira/browse/JDO-625
[Dec 13 2013] AI Craig file a JIRA for java.sql.Blob and java.sql.Clob as 
persistent field types
[Aug 24 2012] AI Craig update the JIRAs JDO-689 JDO-690 and JDO-692 about 
JDOHelper methods. In process.

Craig L Russell
Architect
craig.russ...@oracle.com
P.S. A good JDO? O, Gasp!







[jira] [Comment Edited] (JDO-751) Support for Java8 Optional

2016-07-08 Thread Craig L Russell (JIRA)

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

Craig L Russell edited comment on JDO-751 at 7/8/16 4:38 PM:
-

Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional where T is an 
Immutable Object Class types, java.util.Date, Enum types, or 
Persistence-capable Class types. They may be mapped nullable datastore types or 
to Optional types at the option of the JDO implementation.

When instantiating an instance from the datastore, the JDO implementation would 
get the value v from the datastore and assign the field f = 
Optional.ofNullable(v). When storing the field in the datastore, the 
persistence implementation would store the result of v = 
f.isPresent()?f.get():null.




was (Author: clr):
Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional where T is any 
supported Object type. They may be mapped to nullable datastore types or to 
Optional types at the option of the JDO implementation.

When instantiating an instance from the datastore, the JDO implementation would 
get the value v from the datastore and assign the field f = 
Optional.ofNullable(v). When storing the field in the datastore, the 
persistence implementation would store the result of v = 
f.isPresent()?f.get():null.



> Support for Java8 Optional
> --
>
> Key: JDO-751
> URL: https://issues.apache.org/jira/browse/JDO-751
> Project: JDO
>  Issue Type: New Feature
>  Components: specification, tck
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-751-tck-patch-v5.txt
>
>
> java.util.Optional provides a feature that is available in other languages. 
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this 
> as a "supported persistable type"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


JDO group?

2016-07-08 Thread Craig Russell
The JDO group seems to have disappeared. I’ll set up the Oracle toll-free 
conference number now…

Craig L Russell
Architect
craig.russ...@oracle.com
P.S. A good JDO? O, Gasp!







[jira] [Comment Edited] (JDO-751) Support for Java8 Optional

2016-07-08 Thread Craig L Russell (JIRA)

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

Craig L Russell edited comment on JDO-751 at 7/8/16 3:59 PM:
-

Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional where T is any 
supported Object type. They may be mapped to nullable datastore types or to 
Optional types at the option of the JDO implementation.

When instantiating an instance from the datastore, the JDO implementation would 
get the value v from the datastore and assign the field f = 
Optional.ofNullable(v). When storing the field in the datastore, the 
persistence implementation would store the result of v = 
f.isPresent()?f.get():null.




was (Author: clr):
Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional where T is any 
supported Object type. They may be mapped to nullable datastore types or to 
Optional types at the option of the JDO implementation.



> Support for Java8 Optional
> --
>
> Key: JDO-751
> URL: https://issues.apache.org/jira/browse/JDO-751
> Project: JDO
>  Issue Type: New Feature
>  Components: specification, tck
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-751-tck-patch-v5.txt
>
>
> java.util.Optional provides a feature that is available in other languages. 
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this 
> as a "supported persistable type"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JDO-751) Support for Java8 Optional

2016-07-08 Thread Craig L Russell (JIRA)

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

Craig L Russell commented on JDO-751:
-

I'm still not convinced that optionalPC.orElse(anything) has value anywhere 
except in the SELECT clause. 

> Support for Java8 Optional
> --
>
> Key: JDO-751
> URL: https://issues.apache.org/jira/browse/JDO-751
> Project: JDO
>  Issue Type: New Feature
>  Components: specification, tck
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-751-tck-patch-v5.txt
>
>
> java.util.Optional provides a feature that is available in other languages. 
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this 
> as a "supported persistable type"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JDO-751) Support for Java8 Optional

2016-07-08 Thread Craig L Russell (JIRA)

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

Craig L Russell commented on JDO-751:
-

Starting to work on the specification:

Persistent Object Model 6.4.3

java.lang.Optional

JDO implementations must support fields of type Optional where T is any 
supported Object type. They may be mapped to nullable datastore types or to 
Optional types at the option of the JDO implementation.



> Support for Java8 Optional
> --
>
> Key: JDO-751
> URL: https://issues.apache.org/jira/browse/JDO-751
> Project: JDO
>  Issue Type: New Feature
>  Components: specification, tck
>Reporter: Andy Jefferson
> Fix For: JDO 3.2
>
> Attachments: JDO-751-tck-patch-v5.txt
>
>
> java.util.Optional provides a feature that is available in other languages. 
> Since JDO 3.2 will be for Java8+ then it makes sense to add support for this 
> as a "supported persistable type"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)