java.sql2 annotation usage

Lance Andersen lance.andersen at oracle.com
Fri Oct 20 19:17:34 UTC 2017


Hi Philippe,

So we are all on the same page,  you are talking about using the  Converter annotation which requires the class to  implement AttributeConveter.

This is fairly flexible.

I can see a use case for  Hibernate UserTypes, but not sure I am convinced that is a must for the initial release.

Lukas,  Can you provide an example from JOOQ comparing to the JPA model

Best
Lance


> On Oct 20, 2017, at 8:18 AM, Philippe Marschall <pm at netcetera.ch> wrote:
> 
> On 18.10.17 10:22, Lukas Eder wrote:
>> ...
>> 6) Have there been any discussions about adding converter annotations,
>> which could be used with @SqlColumn(s) and @Field? The @AttributeConverter
>> annotation in JPA is rather powerful for this purpose. jOOQ's Converter SPI
>> is also one of the most used features, as people always have preferences
>> for custom data types that go beyond the simple JDBC types. For example, it
>> would be great if someone was using e.g. a custom data type for IP
>> addresses, they could use their IPType in the @SqlColumn or @Field
>> annotated members, and JDBC would automatically convert those types.
> 
> I'm not happy how JPA @AttributeConverter work. The issue I have with them is that they run after value extraction from the ResultSet in JPA has happened. This is often an issue with vendor types often forcing AttributeConverters to work with Strings because the don't have access to the ResultSet/PreparedStatement. This often leads me to use Hibernate UserTypes which are not portable but give you greater control. Hibernate UserTypes also work with types that span multiple columns, eg. a monetary amount that is made up of an amount and a currency. This is not supported with JPA @AttributeConverter.
> 
> Cheers
> Philippe

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>





More information about the jdbc-spec-discuss mailing list