Hi Lukas,

> Look at custom types to be of an application-wide scope. Not to be
> confused with user-defined types, which are declared on a schema-level
> in the database itself...
>

OK, I think I have covered all aspects, nothing else comes to my mind. So
this is the rule: application-wide mapping.
If there are scope issues, maybe later a mapping definition could be
attached to a factory or settings...

In the case of my dates, I think the best design from a jOOQ user
perspective is to create 3 intermediate date types:
- JOOQDateType
- JOOQBeginDateType
- JOOQEndDateType

These 3 have different jOOQ converters and also have static methods on them
to convert from/to my real business date types.
So, before calling jOOQ, and enforced by jOOQ type system, I have no choice
but to use these 3 intermediate types. The static conversion method would
perform the appropriate business checks.

It is effectively an external conversion, located at the time of calling
jOOQ. It is better than using the SQL date type because it forces
validation of certain business rules and forces the user of the API to
provide appropriate types.

I think the current design is good!

Cheers,
-Christopher

Reply via email to