In the table is a pk with uuid's stored as binary(16).
I'm able to retrieve the hexadecimal using plain sql:
select hex(UUID) as uuid from tbl ;
But the jooq equivalent does not know a hex function.
Result<Record1<byte[]>> result = ctx
.select(tbl.UUID)
.from(tbl)
.fetch();
Casting to String gives the id of the java object.
Any idea's?
Result<Record1<byte[]>> result = ctx
.select(tbl.UUID.cast(String.class))
.from(tbl)
.fetch();
Same problem using ip's (ipv4, ipv6):
select inet_ntoa(conv(hex(IP), 16, 10)) as ip from tbl ;
jOOQ doesn't support all vendor-specific functions out of the box. Whenever you are missing such a function, you can create it yourself using plain SQL:
public class DSLExtensions {
public static Field<String> hex(Field<byte[]> field) {
return DSL.field("hex({0})", String.class, field);
}
}
This obviously holds true for your other functions, too, such as inet_ntoa()
and conv()