I dynamically create and use physical database tables, for which I have only one metamodel object. Example: I have one JOOQ class Customerin my metamodel, but at runtime I have CUSTOMER1, CUSTOMER2etc. I would like to write strongly typed JOOQ queries for these dynamic tables. The following seems to do the trick:
Customer CUSTOMER1 = Customer.rename("CUSTOMER1")
Of course, there are a whole bunch of tables for which I need to do this. Unfortunately, I cannot use the method renamein the general case, because it is not part of the interface Table<R>. Is this oversight or a deliberate measure against something that I do not see?
Is there a sustainable and elegant way to achieve what I want, i.e. not resort to thought?
EDIT: Two tables are never shared in the same query. The specific usage pattern is this: at any moment the synonym DB Customerwill point to one (active), while the other changes (shadow copy). Once the modification is completed, the roles change places, pointing to a synonym for another, and we start over. We do this to minimize the “downtime” of large reporting results tables.
source
share