[jira] [Commented] (JDO-709) Standardize field/property converters

2023-04-08 Thread Jira


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

Tilmann Zäschke commented on JDO-709:
-

The discussion about  @Target(ElementType.TYPE,...) has been moved to a 
separate ticket, concluding that we remove it from the javadoc until an 
implementation is available: 
[JDO-826|https://issues.apache.org/jira/browse/JDO-826]

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (JDO-709) Standardize field/property converters

2023-01-29 Thread Jira


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

Tilmann Zäschke commented on JDO-709:
-

To keep this thread somewhat up to date, there have been three PRs/tickets 
concerning @Convert on types:

* PR by original problem reporter: 
[https://github.com/apache/db-jdo/pull/60|https://github.com/apache/db-jdo/pull/60]
 
* Copy or original PR with additional TCK test: 
[https://github.com/apache/db-jdo/pull/61|https://github.com/apache/db-jdo/pull/61]
* Tickets with problem description on reference implementation: 
[https://github.com/datanucleus/datanucleus-api-jdo/issues/127|https://github.com/datanucleus/datanucleus-api-jdo/issues/127]

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (JDO-709) Standardize field/property converters

2022-10-22 Thread Yubao Liu (Jira)


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

Yubao Liu commented on JDO-709:
---

correction: 

{quote}
configuration file > @Convert on Java type > @Convert on field/key/value
{quote}

This should be configuration file > @Convert on field/key/value > @Convert on 
Java type.


[~clr] Any plan to enable @Convert to target ElementType.TYPE as its Javadoc 
describes now?

Current Javadoc describes:
{quote}
If this annotation is placed on a type, then the conversion applies to all 
fields or properties whose types
match the entity type of the given \{@link AttributeConverter}.
Any \{@link Convert} annotations placed on members overrides any type-level 
conversion specifications.
{quote}

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (JDO-709) Standardize field/property converters

2022-10-18 Thread Yubao Liu (Jira)


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

Yubao Liu commented on JDO-709:
---

I need add data encryption in service layer because open source databases don't 
have good support on encryption,  this is a simplified code example:

```java
public class FooEntity {

String id;
 
  @Encrypted
NameEnc name;

   @Encrypted
   AddressEnc address;
}
```

I have many tables, so many entity classes,  and we probably will have more and 
more, some of these tables contain sensitive column, the `@Encrypted` 
annotation will be processed by an annotation processor which generates class 
like this:

```
@Convert(NameEnc.JdoAttributeConverter.class)   // <--- it's a pity this isn't 
supported by JDO.
public class NameEnc {
  String value;   // actually it has more fields related to encryption.

  public static class JdoAttributeConverter implements 
AttributeConverter {
...
 }
}
```

I have many generated java classes for these encrypted column, I wouldn't like 
to list them in persistence.xml or some other JDO configuration file, because I 
have a lot and will have more and more.

If `@Convert` can be used on Java type as *its javadoc describes now*,  that 
would be very convenient.  There won't be any confusion, the converter priority 
can be configuration file > @Convert on Java type > @Convert on 
field/key/value.   If somebody defines multiple AttributeConverter classes for 
same Java type, we can explicitly specify the desired converter in 
configuration file.


> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (JDO-709) Standardize field/property converters

2022-10-16 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

> What's the alternative solution?

Perhaps you could be explicit with some sample code that you would like to see 
supported. Thanks.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (JDO-709) Standardize field/property converters

2022-10-16 Thread Yubao Liu (Jira)


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

Yubao Liu commented on JDO-709:
---

> It looks like we do not need the @Target(ElementType.TYPE,...) on the 
> @Convert annotation either.

What's the alternative solution? I use Java annotation processor to generate a 
lot of types, would like to have @Convert(converter = some.class) on these 
types.  It's annoying to list them in some configuration file or even embed 
@Persist to a lot of class fields.

BTW, the javadoc on @Convert still says it can apply to type...

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-11 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

I've rewritten parts of Chapter 18. The slant of this chapter has been toward 
annotations which belong in Chapter 19. The xml specification does not have 
detailed descriptions of the key and value. These are described in the element, 
array, collection, and map elements.

What follows are the proposed changes. ELEMENT converter is new; there is an 
extra paragraph in ELEMENT element:

6 ELEMENT converter
When used with a field or property, the converter element identifies the class 
used with the convertible field to convert values in the field or property to 
and from values in the datastore. Similarly, when used with key, value, or 
element, it identifies the converter used to convert Map keys and values, and 
Collection and Array elements.
The converter class must be loadable at runtime by the same class loader as the 
domain object.

7 ELEMENT element

... The converter attribute specifies the AttributeConverter to use for the 
element. 

 

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-11 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

Here's a proposed paragraph in Chapter 6 discussing Maps and Collections using 
converters.
 
JDO implementations that support Maps and Collection types must support 
converting keys, values, and elements of supported types according to the 
corresponding Key, Value, or Element metadata.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-10 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

It looks like we do not need the @Target(ElementType.TYPE,...) on the @Convert 
annotation either.


This would be useful for indicating that any use of the converted type would 
use the converter without a specific annotation on the field. But it is also a 
bit harder to figure out that a type is converted by default, and we would then 
need to document that behavior.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-09 Thread Andy Jefferson (Jira)


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

Andy Jefferson commented on JDO-709:


Good. Ignore the last comment on attributeName, of course I put "converter" on 
the Key, Value and Element annotations, so we don't need that anyway.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-09 Thread Michael Bouschen (Jira)


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

Michael Bouschen commented on JDO-709:
--

I removed the Converts annotations (and the @Repeatable(Converts.class) in 
Covert) and could successfully run the TCK.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-09 Thread Andy Jefferson (Jira)


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

Andy Jefferson commented on JDO-709:


The other use of the "attributeName" was when wanting to define a converter for 
the key/value of a Map (attributeName="key", or attributeName="value"), or when 
we have a Collection of some non-persistable element and wanting to define a 
converter for the element type. That could be of use, and DataNucleus has the 
code for it ... but it does not require the Converts annotation though.

So we could add the attributeName to the Convert annotation just for those 3 
specific cases, but ignore the embedded field converter override.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-09 Thread Andy Jefferson (Jira)


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

Andy Jefferson commented on JDO-709:


[~clr] Yes, the "attributeName" was omitted when it was added in 2015; can't 
remember why. Easiest option is just to remove "Converts" and move forward, and 
maybe add a javadoc comment (to the Convert annotation that an attribute could 
be added if wanting to support overriding the specification of converters for 
fields of embedded objects) or just add a Jira issue for a future release. But 
then I'm not exactly so much in favour of using annotations for such things; 
I've never had a need to override a default converter for a field, defined on 
the embedded class; the JDO XML definition is way more expressive to achieve 
that (IMHO)

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-06 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

[~tilmannz] suggests that the term "convertible" would be clearer than 
"converted" when referring to the field type of a persistence-capable class. An 
instance of a convertible class can be constructed by converting a database 
value, and a database value can be constructed by converting an instance of a 
convertible class.

This terminology change makes sense to me.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-06-06 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

[~andyj] When we reviewed the metadata and annotations we found that the JDO 
Convert annotation differs from the JPA Convert annotation. JPA has the 
attribute name that is not needed if the annotation applies to a field but 
would be needed if the annotation applies to a class. If annotating a class, 
multiple Convert annotations can be used, and the attribute name is needed to 
tell which field is being annotated.

The JDO Convert annotation doesn't have the attribute name, but it does have 
the multiple Converts annotation that applies to a persistent class. So it is 
inconsistent.

To fix the inconsistency we can either remove the Converts annotation and 
remove the Convert applying to a class; or add the attribute name to the 
Convert annotation. If we add the attribute name we should probably add a test 
case with Converts and multiple Convert applying to multiple attributes.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-05-12 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

If a field is annotated with a Column annotation, it is assumed to be 
persistent.

I believe that if a field is annotated with a Convert annotation it should be 
assumed to be persistent, since the only possible reason for the Convert 
annotation is to map values to and from the database. This should be true even 
if there is no Column annotation because the defaults in the Column annotation 
might be sufficient for the converted field.

>From the proposed Chapter 18 changes:

> For fields using converters, the default jdbc-type is the default jdbc-type 
> for the database type of the AttributeConverter for the field.

 

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-05-12 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

[~andyj] 

> A "converted class" doesn't track changes *unless* the provider happens to 
> have a wrapper class for that type. There is no obligation on a JDO provider 
> to provide a wrapper for all possible types that a user may want to convert.

I agree with this. I've removed the wording that proposed to treat converted 
fields as if they were fields of mutable system types.

 

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-05-12 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

18.4.1 Element convert

The convert element identifies the converter used with the field to map values 
in the class to and from values in the database. The value attribute identifies 
the class that implements the AttributeConverter interface. The converter class 
must be loadable at runtime by the same class loader as the domain object.

after Table 8

For fields using converters, the default jdbc-type is the default jdbc-type for 
the database type of the AttributeConverter for the field.

19.1.2.1 Convert annotation

@Retention(RetentionPolicy.RUNTIME)

@Target(\{ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})

@Repeatable(Converts.class)

public @interface Convert {

/**

* The \{@link AttributeConverter} to use for conversion.

* @return Converter class to use

*/

@SuppressWarnings("rawtypes")

Class value();

/**

* Whether this conversion is enabled. True by default.

* Setting this to false allows disabling conversion that was specified at PMF 
level.

* @return Whether the PMF default converter is enabled

*/

boolean enabled() default true;

}

19.1.2.2 Converts annotation

@Retention(RetentionPolicy.RUNTIME)

@Target(\{ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})

public @interface Converts {

/**

* The conversion specifications to be configured.

* @return Array of converters

*/

Convert[] value();

}

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-05-10 Thread Andy Jefferson (Jira)


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

Andy Jefferson commented on JDO-709:


A "converted class" doesn't track changes *unless* the provider happens to have 
a wrapper class for that type. There is no obligation on a JDO provider to 
provide a wrapper for all possible types that a user may want to convert.

Fields of a "converted class" are not declared using metadata; the user simply 
provides a converter that does the conversion for that type.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-04-30 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

Here are proposed specification updates.
5.4.1 Application identity

No change unless we decide to allow converted fields to be primary key fields.

6.3 Second Class Objects

Second Class Objects are instances of:
-  immutable system classes (java.lang.Integer, java.lang.String, etc.), 
- JDO implementation subclasses of mutable system classes that implement the 
functionality of their system class (java.util.Date, java.util.HashSet, etc.)
- user-defined non-persistence-capable classes that use a user-defined 
converter (converted classes)
- persistence- capable classes.

Second Class Objects of mutable system classes, converted classes, and 
persistence-capable classes track changes made to them, and notify their owning 
FCO that they have changed. 

SCO fields of converted classes are declared using metadata, either in the 
associated jdo metadata file or via annotation.

6.4 Field types of pc classes

6.4.3 Persistent fields

Converted Types
JDO implementations must support fields of user-defined types that have an 
associated converter that defines conversion of values between the user-defined 
type and a supported database type. 

14.6 Query Interface
void declareParameters (String parameters);
Bind the parameter statements to the query instance. This method defines the 
parameter types and names that will be used by a subsequent execute method. 
Converted types may be used as parameters.

14.6.2 Query Filter Specification
Rules for constructing valid expressions follow the Java language, except for 
these differences:
• Equality and ordering comparisons between primitives, instances of converted 
classes, and instances of wrapper classes are valid.
• Equality and ordering comparisons between instances of converted classes use 
the converted values for comparison.
• Arithmetic operations (addition, subtraction, multiplication, division, or 
modulo) on fields use the converted values as the expression terms.
Methods apply to converted types.



> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-04-29 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

Great test case. 

For me, two questions remain: 

1. should we allow fields of converted types to be used as primary keys, 
indexes, or optimistic concurrency fields?

I can see a use for indexes but perhaps not other cases. Converting a database 
value that is indexed seems to be useful. 

Converting database primary keys has no barriers to understanding but might 
pose some implementation challenges. But absent a compelling use case I can 
understand why we might disallow it.

2. Do we need a test case for using annotation to define the converter, or are 
we happy with using external metadata?

If we want to test annotation, that would imply another class, e.g. 
PCRectStringAnnotated. Same test methods but using PCRectStringAnnotated 
instead of PCRectString...

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-04-25 Thread Craig L Russell (Jira)


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

Craig L Russell commented on JDO-709:
-

Maybe we should add a query like "where UL eq Point(1, 2)" to see if the 
converter can be invoked from a query.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2021-04-25 Thread Michael Bouschen (Jira)


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

Michael Bouschen commented on JDO-709:
--

First version of an AttributeConverter TCK test class is in branch JDO-709.

Please have a look and feel free to comment.

> Standardize field/property converters
> -
>
> Key: JDO-709
> URL: https://issues.apache.org/jira/browse/JDO-709
> Project: JDO
>  Issue Type: New Feature
>  Components: api, specification, tck
>Reporter: Matthew T. Adams
>Assignee: Craig L Russell
>Priority: Minor
>  Labels: converstion, converter, jdo, type, type-converter
> Fix For: JDO 3.2
>
> Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch
>
>
> This request is to standardize a user's ability to specify conversions of 
> fields or properties of persistence-capable classes.  Currently, this is left 
> to vendor extensions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-30 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14565853#comment-14565853
 ] 

Andy Jefferson commented on JDO-709:


 @Andy: If we [default the useDefaultConversion to] false then that implies 
 it will need a provided converter.
 I think the only confusion is in case 1 where it may sound like both use 
 default converter class and don't use default conversion. 
 Which is the confusion between annotation default and default behavior. 

Indeed. It is misleading. The converter attribute default says use the 
default conversion, whilst the boolean useDefaultConversion says DON'T use 
the default conversion.

 At runtime, I don't think the template types are available, as they have been 
 erased. 
 How does the implementation figure out the A and D of AttributeConverterA, 
 D? Do we need to add ...

The code at 
https://github.com/datanucleus/datanucleus-api-jdo/blob/master/src/main/java/org/datanucleus/api/jdo/JDOTypeConverterUtils.java
works fine for cases I've used. For example if I have a converter

public class CurrencyAttrConverter implements AttributeConverterCurrency, 
String
{
public Currency convertToAttribute(String str)
{
if (str == null)
{
return null;
}
return java.util.Currency.getInstance(str.substring(5));
}

public String convertToDatastore(Currency curr)
{
return curr != null ? (CURR: + curr.toString()) : null;
}
}

then use of those methods returns the attribute type as Currency, and the 
dbType as String.

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-30 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14566030#comment-14566030
 ] 

Craig L Russell commented on JDO-709:
-

 @Andy: If we [default the useDefaultConversion to] false then that implies 
 it will need a provided converter.
 I think the only confusion is in case 1 where it may sound like both use 
 default converter class and don't use default conversion. 
 Which is the confusion between annotation default and default behavior.
Indeed. It is misleading. The converter attribute default says use the 
default conversion, whilst the boolean useDefaultConversion says DON'T use 
the default conversion.

I'm willing to live with the potential confusion since no one will ever 
explicitly use converter(UseDefault.class).

The code at 
https://github.com/datanucleus/datanucleus-api-jdo/blob/master/src/main/java/org/datanucleus/api/jdo/JDOTypeConverterUtils.java
works fine for cases I've used. 

Thanks for the example. I don't see anything wrong with this approach.

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-29 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14565046#comment-14565046
 ] 

Craig L Russell commented on JDO-709:
-

Apologies for the null annotation issue. I'll fall on my sword.

My biggest concern is the naming of disableConversion. It really means use 
Implementation Conversion since there is always a conversion. It might help if 
we talk about default to mean only the JDO specified implementation default. 
Everything else is an override, which can be specified at the PMF level, the 
class level, and the field (key and value as well) level.

I guess it would be clearer for me to have useDefaultConversion in the 
annotation. You can override the default conversion either at the PMF, the 
class, or the field/key/value level.

1. If neither is specified on the the annotation:  - use class-level converter 
if available, else use PMF converter if available, otherwise fallback to 
default implementation handling.
2. If only the useDefaultConversion is specified (true): - use default 
implementation handling
3. If only the converter is specified as converter(SpecialConverter.class): - 
use converter
4. If both the converter is specified as converter(SpecialConverter.class), 
useDefaultConversion(true): - this is an error and throws an exception during 
annotation processing.

Along the same lines, how about changing the name of the marker converter:

+   public static class UseDefault implements AttributeConverterObject, 
Object
+   {
+   public Object convertToDatastore(Object attributeValue) {
+   throw new JDOUserException(This converter is not 
usable.);
+   }
+
+   public Object convertToAttribute(Object datastoreValue) {
+   throw new JDOUserException(This converter is not 
usable.);
+   }
+   }







 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-29 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14565104#comment-14565104
 ] 

Andy Jefferson commented on JDO-709:


+1 on the rename of the default annotation converter.

Yes the boolean means what you say (and no problem with the name you proposed), 
the only thing is that in an annotation it needs a default value. If we put 
false then that implies it will need a provided converter. If we put true 
then that implies it will have to be set to false. An alternate would be to 
NOT have as a boolean (like we did for all other annotations), and instead have 
as String ... then the default would be , and your rules would work.

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-29 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14565333#comment-14565333
 ] 

Craig L Russell commented on JDO-709:
-

Some of the confusion is the use of the term default for annotation defaults 
and behavior defaults. 

Maybe an example will help me understand better, using the annotation default 
value for converter(UseDefault.class) and useDefaultConversion(false):

Case 1:
@Persistent(column(ss_name)), 
or what is seen by the implementation with default values for annotation:
@Persistent(column(ss_name), converter(UseDefault.class), 
useDefaultConversion(false))
Standard behavior: in order, use the class converter for the type, or the PMF 
converter, or the default conversion

Case 2:
@Persistent(column(ss_name), useDefaultConversion(true)), 
or what is seen by the implementation with default values for annotation:
@Persistent(column(ss_name), converter(UseDefault.class), 
useDefaultConversion(true))
use the default conversion regardless of whether a converter is specified at 
the class or PMF

Case 3:
@Persistent(column(ss_name), converter(SpecialConverter.class)), 
or what is seen by the implementation with default values for annotation:
@Persistent(column(ss_name), converter(SpecialConverter.class), 
useDefaultConversion(false))
use the special converter specified

Case 4:
@Persistent(column(ss_name), converter(SpecialConverter.class), 
useDefaultConversion(true)), 
or what is seen by the implementation with default values for annotation:
@Persistent(column(ss_name), converter(SpecialConverter.class), 
useDefaultConversion(true))
error at the time this class is loaded

@Andy:  If we [default the useDefaultConversion to] false then that implies 
it will need a provided converter. 
I think the only confusion is in case 1 where it may sound like both use 
default converter class and don't use default conversion. Which is the 
confusion between annotation default and default behavior. 


 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-29 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14565341#comment-14565341
 ] 

Craig L Russell commented on JDO-709:
-

I'm having trouble understanding how the implementation can process the 
Converters annotation. The value is a list of Convert annotations and the 
implementation is supposed to figure out to which domain type the values 
(AttributeConverter) apply.

At runtime, I don't think the template types are available, as they have been 
erased. How does the implementation figure out the A and D of 
AttributeConverterA, D? Do we need to add 

ClassA getAttributeClass() and
ClassD getDatabaseClass()

to the interface requirements of AttributeConverter?


 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-18 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14549726#comment-14549726
 ] 

Andy Jefferson commented on JDO-709:


As said above, you cannot do default null (my comment crapness of Java 
annotation defaulting). Maybe get those Java language spec people at Oracle to 
allow it?

If you specify converter and disableConversion then the disable is ignored. 
It means the exact same as the XML variant that was already discussed. i.e
1. No converter, no disable - use PMF converter if one is provided
2. No converter, with disable - use no converter
3. Converter specified - use converter

PMF level means the same as your PMF converter

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-18 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14549390#comment-14549390
 ] 

Craig L Russell commented on JDO-709:
-

Do we really need NullAttributeConverter? It seems pointless. Was this perhaps 
supposed to be default null?

The Persistent disableConversion seems awkward. If you specify a Converter and 
then disableConversion what happens? Seems like an error. 

+* Whether we should disable any conversion specified at the PMF level 
(where converter is not specified).
+* @return Whether PMF attribute conversion is to be disabled.

What does PMF level (where converter is not specified) mean?

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-3.patch, JDO-709-4.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-17 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14547072#comment-14547072
 ] 

Andy Jefferson commented on JDO-709:


XML schema updates now in SVN.

Something that would make the annotation route much better for handling 
embedded fields is to be able to specify the converter in @Persistent, 
@Element, @Key, @Value (so we can get rid of the name attribute from @Convert 
- seems this was copied from JPA where they have no concept of key or value 
metadata). The problem with this is the crapness of Java annotation defaulting, 
where we can't have a default of null. That is, it would be nice to add this to 
@Persistent etc

Class? extends AttributeConverter converter() default null;

we can't do that, and we can't use void.class either due to the generics 
usage on the Class. 

My suggestion is that we create an arbitrary NullAttributeConverter class that 
is then specified as the default (and an implementation can check for that and 
ignore it if so). Opinions?

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-xml-2.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-15 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14545795#comment-14545795
 ] 

Craig L Russell commented on JDO-709:
-

Three cases to consider for disable converter:

1. Use a specific converter not the default. This is easy. Specify a Convert 
annotation that overrides the default.

2. Don't use the pmf converter for an element. Use the standard converter. Here 
we need a disable pmf converter on the element. 

3. Don't use the pmf converters for any elements in a class or interface.  Here 
we need a disable pmf converter on the class or interface. Any elements that 
cannot use the default converter need to have a specific converter on the 
element. For example, if there is a converter that converts database strings to 
dates, if all pmf converters are disabled on a class, the field needs to have 
its own converter specified.



 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch, JDO-709-xml-1.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-05-08 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14535039#comment-14535039
 ] 

Craig L Russell commented on JDO-709:
-

@Andy: Yes, if a global change to a type is needed, it can't simply be an 
annotation but has to be defined at the PMF level.

If the global converter isn't appropriate for a specific class then that class 
can be annotated with a different converter.

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-04-28 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14516610#comment-14516610
 ] 

Andy Jefferson commented on JDO-709:


Re: Converter, that was simply to allow some form of defaulting mechanism for 
handling fields of a type (from JPA) hence avoiding the need to specify 
@Convert on every field of a type. Actually there is nothing in JPA to prevent 
the user from (incorrectly) defining multiple (autoApply) @Converter for a 
particular java type ... hence a better way of achieving this is desirable, i'm 
open to ideas. 

Maybe (instead of @Converter) we could have properties you can specify on PMF 
startup like javax.jdo.option.typeconverter.{XXX} (where XXX is the 
fully-qualified type name of the java type) and set this to the 
AttributeConverter class name that is the default for that type (and is used if 
present in the CLASSPATH and no @Convert is specified against a field of that 
type).

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-04-24 Thread Craig L Russell (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14511326#comment-14511326
 ] 

Craig L Russell commented on JDO-709:
-

I think we need an example of how the Converter annotation would be used.


 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-04-18 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14501378#comment-14501378
 ] 

Andy Jefferson commented on JDO-709:


Majority of the patch was applied, with some changes
1. Apache copyright added
2. Omitted the package-level capabilities since we need to get something for 
95% of the use-cases first (of which package is not). We can always extend to 
that in the future.
3. Renamed Converters to Converts and added Converter annotation to allow 
for autoApply setting a default of whether a converter should default to 
being applied (following JPA converters).

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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


[jira] [Commented] (JDO-709) Standardize field/property converters

2015-04-15 Thread Andy Jefferson (JIRA)

[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14496247#comment-14496247
 ] 

Andy Jefferson commented on JDO-709:


Patch looks fine to me. 
RI already supports the basic idea so will be trivial to enable this.
Clearly we also need the XML updating, but that can come next.

 Standardize field/property converters
 -

 Key: JDO-709
 URL: https://issues.apache.org/jira/browse/JDO-709
 Project: JDO
  Issue Type: New Feature
  Components: api
Reporter: Matthew T. Adams
Assignee: Matthew T. Adams
Priority: Minor
  Labels: converstion, converter, jdo, type, type-converter
 Fix For: JDO 3.2

 Attachments: JDO-709-01.patch


 This request is to standardize a user's ability to specify conversions of 
 fields or properties of persistence-capable classes.  Currently, this is left 
 to vendor extensions.



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