[ 
https://issues.apache.org/jira/browse/JDO-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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<NameEnc, String> {
        ...
     }
}
```

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)

Reply via email to