Wow, it seems that interface idea was even better than i thought ;)

There's another (wild) idea related to interfaces that crossed my mind
when i was thinking about inheritance and interfaces. In absence of
real "inheritance" functionality, many databases have multiple tables
that follow the same "base column pattern", for example:

id int primary key,
creation_time timestamp,
modification_time timestamp,
creator_uid int,
mutator_uid int

.. etc. Sometimes it would be nice to be able to write code that is
able to treat these base columns of records of any of these tables the
same way. Currently that is very hard to do with jOOQ because all
generated Record classes directly extend UpdatableRecordImpl, which -
of course- doesn't have any getter or setter methods for these
columns.

If it would be possible to define a "base table" interface (let's say
MyBaseRecord) with getter and setters for these "base" columns, and
instruct the code generator (via some configuration option similar to
the master data table options) to let certain Record classes (or
interfaces) implement MyBaseRecord (just get it to add 'implements
MyBaseRecord' to the class/interface definition), then one could write
methods that work on MyBaseRecord instances.

More complex cases with multiple interfaces extending eachother could
also be possible. Of course, the correct definition of these
interfaces is up to the user. If he defines an interface that doesn't
match the actual record classes, the code just won't compile.

Reply via email to