Subject Re: [Firebird-Java] eclipse/jaybird/dtp : Date type to LocalDate
Author Mark Rotteveel
On 23-10-2015 18:07, pablos@... [Firebird-Java] wrote:
> I'm a newbie (to java), using firebird_DTP_1.0.2.201106021154.zip with
> eclipselink .
>
> I see that classes generated by eclipselink use dates as java.util.Date .
> I'd like to change it for java.time.LocalDate type (if it's a reasonable
> change, mind you) .
>
> Is there anything to change like in
> org.eclipse.datatools.enablement.firebird.dbdefinition_1.0.2.201106021154.jar,
> on /runtime/vendors/Firebird/Firebird_2_1.xmi the node ?
>
> Example:
> <predefinedDataTypeDefinitions xmi:id="DATE_1"
> keyConstraintSupported="true" primitiveType="DATE" jdbcEnumType="91"
> javaClassName="java.sql.Date">
> <defaultValueTypes>NULL</defaultValueTypes>
> <defaultValueTypes>CURRENT_DATE</defaultValueTypes>
> <name>DATE</name>
> </predefinedDataTypeDefinitions>
>
> I c an't figure where java.sql.Date there, translates to java.util.Date
> into the class code generated .
>
> Will that change the code generated for dates from java.util.Date to
> java.time.LocalDate ?
>
> Or I have to dig into eclpselink stuff...

It has been a while since I did anything with the Firebird DTP code, so
I can't exactly recall the details. As far as I know the handling of the
mapping itself is part of the core DTP (or maybe EclipseLink), and I
don't know if you can easily change that to other types without making
changes to the core of DTP/EclipseLink.

One problem is that if you look at the JDBC specification, DATE maps to
java.sql.Date, etc and most tooling defers to that standard mapping.

Another problem is that although Jaybird (since 2.2.4) has some
java.time support, it is far from complete (you can only get, not set
java.time values at the moment).

Mark
--
Mark Rotteveel