java.sql2 annotation usage
Philippe Marschall
pm at netcetera.ch
Fri Oct 20 12:18:31 UTC 2017
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
More information about the jdbc-spec-discuss
mailing list