Hi Dennis,

Actually, I've thought of another immediate solution to your problem.
In your current trigger code, jOOQ has no way of unambiguously
associating your converter with the expected GregorianCalendar type,
as the ResultSet provided from H2 does not contain any reference to
jOOQ's generated TEST table and its referenced converters. But you can
explicitly provide that information to the fetchLazy() method:

    final Cursor<Record> result = create.fetchLazy(newRow, TEST.fields());

Using:
http://www.jooq.org/javadoc/latest/org/jooq/DSLContext.html#fetchLazy%28java.sql.ResultSet,%20org.jooq.Field...%29

This feature was added in jOOQ 3.0-RC1:
https://github.com/jOOQ/jOOQ/issues/1144

This will use the generated TableFields with their associated
DataTypes explicitly referencing your converter. In other words, the
Cursor that you're creating like this will contain GregorianCalendar
instances for DATE_OF_START, not Timestamp instances, as provided by
H2.

Hope this helps

Cheers
Lukas

2013/4/19 Lukas Eder <[email protected]>:
> Hi Dennis,
>
> Thanks again for your test-case. It was easy to reproduce the issue
> you were having with it.
> Here are a couple of observations:
>
> - The Converter is properly registered by the time the trigger is called.
> - Registered Converters are not (yet) active when using POJO mapping
> through Record.into(). This is a pending feature request:
> https://github.com/jOOQ/jOOQ/issues/2029
>
> Your use case could be quick-fixed by trying to look up custom
> converters in methods like Record.getValue(xx, Class). However, the
> way converters work right now, it is non-trivial to get this right, as
> converters are registered statically from generated code, i.e. when
> DataType.asConvertedDataType() is called. This design is insufficient
> for a more general, automatic data type conversion scenario, so I
> prefer not to fix this issue before finding a better solution for the
> Converter registry. I might call for feedback on this user group in a
> separate thread.
>
> As an immediate solution to your issue, I suggest you do not use
> Record <-> POJO mapping in your H2 trigger implementation. I.e.,
> instead of
>
>     final Test record = result.fetchOneInto(Test.class);
>
> Write
>
>     final Record record = result.fetchOne();
>
> Cheers
> Lukas
>
> 2013/4/14 Lukas Eder <[email protected]>:
>> Great, thanks Dennis!
>> I hope to have some time soon, to have a deeper look at what's going on!
>>
>> Cheers
>> Lukas
>>
>> 2013/4/14 Dennis Fischer <[email protected]>:
>>> Okay, there ya go (eclipse maven project with 3 classes + generation xml
>>> file + generated classes). 2 "test-methods".
>>> https://docs.google.com/file/d/0B2I0gRD-ClFRMWhCREJlZGtFWnM/edit
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "jOOQ User Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to