I have a custom binding written to convert from custom type to Postgres json type. This part of the documentation mentions how to register using xml but I'm using Java. I have tried to search to find how to do that but in vain.
Any help is appreciated.
There's a manual section about programmatic code generator configuration here:
http://www.jooq.org/doc/latest/manual/code-generation/codegen-programmatic
Essentially, all XML elements also exist as Java types, which are generated with XJC from the code generation configuration XSD, so all XML configuration maps 1:1 to Java configuration, including that for data type bindings (via ForcedType
objects).
The code generator doesn't do anything magic. Everything it does, you can do manually as well. You can easily call:
DataType<MyJsonType> jsonType =
SQLDataType.VARCHAR.asConvertedDataType(new MyJsonBinding());
Field<MyJsonType> jsonField = field(name("my_table", "my_column"), jsonType);
Of course, using the code generator instead will greatly help...