On Friday, August 18, 2017 at 3:31:15 PM UTC+2, Lukas Eder wrote:
>
>
>
> 2017-08-17 21:21 GMT+02:00 <[email protected] <javascript:>>:
>
>> I want to bind my composite type to my own Java object and not to the UDT
>> object generated by Jooq.
>>
>
> I wouldn't do that if I were you. We've fixed tons of bugs over the last
> releases to get this to work with all sorts of potentially nested UDTs and
> arrays and what not. The PostgreSQL JDBC driver is very incomplete as far
> as binding PostgreSQL's advanced data types are concerned. Ultimately, it
> just boils down to parsing / serialising things to strings.
>
Ah, ok. My composite type is really simple and I don't need nested UDTs or
arrays. Should that work or do you still advice against it?
>
> Having said so, you can easily apply a Converter (rather than a Binding)
> to automatically map the generated jOOQ UDTRecord to your custom type.
> Implementing a Converter is also much simpler than implementing a Binding
>
I've tried creating a Converter but it only accepts the following converter:
public class MyTypeConverter implements Converter<Object, MyType> { ... }
(note its converting from Object and not the UDT type) that's why I though
it needed a Binding instead.
In my gradle build I have this:
forcedTypes {
forcedType {
userType = "jooqtest.MyType"
expression = "test.mytable.value"
converter = "jooqtest.MyTypeConverter"
}
}
and it all seems to work, except for the converter trying to convert from
an Object instead of the JOOQ generated UDT type MytypeRecord. Am I missing
something?
Thanks,
Ralph.
--
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/d/optout.