> To do anything useful with this in jOOQ, the inheritance hierarchy
> would need to be reflected in the generated Table and Record classes
> though, and some tricks would probably be required to allow casting
> between super and sub types.

Another thought is to simply let generated tables/table records extend
each other. As in the Postgres example:

------------------------------------------------
class CitiesRecord extends TableRecordImpl<CitiesRecord>;
class CapitalsRecord extends CitiesRecord;

class Cities extends TableImpl<CitiesRecord>;
class Capitals extends Cities;
------------------------------------------------

As can be seen above, the problem will arise when it comes to the
generic <R extends Record> parameter. Today, "covariant generic
inheritance" of table types is not possible. Maybe something like this
should be done instead (only if inheritance is involved):

------------------------------------------------
class CitiesRecord<R extends CitiesRecord> extends
TableRecordImpl<CitiesRecord>;
class CapitalsRecord extends CitiesRecord<CapitalsRecord>;

class Cities<R extends CitiesRecord> extends TableImpl<CitiesRecord>;
class Capitals extends Cities<CapitalsRecord>;
------------------------------------------------

On the other hand, introducing another generic type parameter to
generated classes will be somewhat cumbersome...

Reply via email to