> Thanks for the hint ... works nicely :-)
>

Good to know


> Maybe you should use VARCHAR as the SQL data type and convert the value
> using CAST(? as inet) and CAST(? as text) when sending / receiving an inet
> address from the database.
>

I think I've seen other databases supporting similar types. It may make
sense to introduce a more formal type support.
Note that jOOQ needs the extra type information to be able to know when to
cast. With VARCHAR / String, that is not possible. Also, converters won't
help in this case.


> InetAddress makes sense for mapping into java world, alternatively
> java.lang.String could make sense, too
>

See above, a distinct DataType / Class is needed to know how to properly
cast it.


> Be aware that InetAddress might cause unwanted DNS lookups (eventually
> depending on OS) when instantiating the object.
>

I was thinking about using this method here:
http://docs.oracle.com/javase/6/docs/api/java/net/InetAddress.html#getByAddress(byte[])

According to the Javadocs, the method doesn't perform any lookups and
doesn't block...
Another option is to introduce a minimal INET implementation in
org.jooq.types, similar to unsigned integers and interval data types.

Reply via email to