Hi,
We've factored some of our JOOQ code to run routines on tables with a
similar structure. Here's an example where we delete rows in tables that
have a column called ENDPOINT (pardon the Scala):
def deleteRecordsInSpace[R <: Record](t: Factory, space: Long, table:
Table[R]) = {
t.delete(table).where(table.getField("ENDPOINT").in(
t.select(ENDPOINTS.ID).
from(ENDPOINTS).
where(ENDPOINTS.SPACE.equal(space))))
}
Notice that the table.getField("ENDPOINT") call has effectively lost its
type check with this factoring. Having said that, I can't think of a way to
use the code generated artifacts and keep the same factoring. So I was
wondering if there is a way to somehow duck type table references based on
a commonality (e.g. a common column name)?
Cheers,
Ben