Hi Lukas,
This is the configuration and converter:
// skipped jdbc
Converter<UUID, MyUuid> uuidToMyUuid = Converter.of(
UUID.class,
MyUuid.class,
MyUuid::create,
myUuid -> UUID.fromString(myUuid.asString())
);
Configuration configuration =
new Configuration()
.withJdbc(jdbc)
.withGenerator(new Generator()
.withStrategy(new Strategy()
.withName(DefaultGeneratorStrategy.class.getName()))
.withDatabase(new Database()
.withIncludes(".*")
.withExcludes("")
.withInputSchema("public")
.withCustomTypes(
new CustomType()
.withName(uuidToMyUuid.toType().getName())
.withType(uuidToMyUuid.toType().getName())
.withConverter(uuidToMyUuid.getClass().getName())
)
.withForcedTypes(
new ForcedType()
.withName(uuidToMyUuid.toType().getName())
.withTypes("UUID")
)
)
.withGenerate(new Generate()
.withDaos(false)
.withPojos(false)
.withRecords(true)
.withInterfaces(false)
)
.withTarget(new Target()
.withPackageName("")
.withDirectory("../src/main/java"))
);
GenerationTool.generate(configuration);
Thanks,
Kiru
Am Freitag, 21. April 2017 12:19:15 UTC+2 schrieb Lukas Eder:
>
> Hi Kiru,
>
> Thanks for your nice words.
>
> It's perfectly possible to register converters that use generics, but
> perhaps you haven't configured the code generator correctly? Can you please
> post your converter and your code generator configuration?
>
> Thanks,
> Lukas
>
> 2017-04-21 12:08 GMT+02:00 Kirusanth Poopalasingam <[email protected]
> <javascript:>>:
>
>> Hello Lukas,
>>
>> First, thank you for creating jOOQ ( and giving a serious alternative to
>> JPA / Hibernate). We use jOOQ heavily in our projects.
>>
>> For primary and foreign keys, we have a custom UUID class with generics
>> like MyUuid<T> and added a Converter from java.util.UUID to our MyUuid.
>>
>> With the generic-MyUuid, you get an additional type safety. Now the
>> problem is, that the converter does not respect the generic type and
>> generates Methods like:
>>
>> public class MyTableRecord ... {
>> // ...
>> public void setId(MyUuid value) { // better:
>> setId(MyUuid<MyTableRecord> value)
>> setValue(0, value);
>> }
>>
>>
>> public void setOtherFk(MyUuid value) { // better:
>> setOtherFk(MyUuid<OtherRecord>
>> value)
>> setValue(6, value);
>> }
>> // ...
>> }
>>
>>
>>
>> Is there a way to hook into the code-generation process to set the
>> generic types-correctly.
>>
>> ( Tested with jOOQ 3.9.1 and PG 9.1)
>>
>> Thank you,
>> Kiru
>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.