To support Dynamic processing: find generated UpdatableTable classes with tablename (a string: Schema.Table1)

9 views
Skip to first unread message

david sheng

unread,
Aug 16, 2016, 4:36:42 AM8/16/16
to jOOQ User Group
All my tables are auto-generated from DB with jooq, (i.e. updatableTables)
it's good enough if I just write like:  factory.table('tablename') to perform gerneral operations
but there always a need to dynamically process certain SQL, also  requires certain features of updatableTables, such as RecordListner

My question:
How to point to a generated UpdatableTable class with tablename (a string like: 'Schema.TABLE1',  -- dbtables.records.Table1Record implements UpdatableRecordImpl).

I am not sure if this feature has been implemented or if there is an easier workaround to simply get it work, please kindly help drag me to the right direction. Cheers


Lukas Eder

unread,
Aug 16, 2016, 12:18:52 PM8/16/16
to jooq...@googlegroups.com
Hi David,

You could use your generated schema's getTables() method and then filter for UpdatableTable types:

SCHEMA
    .getTables()
    .stream()
    .filter(UpdatableTable.class::isInstance)
    .filter(t -> "TABLE1".equals(t.getName))
    .findAny();

There are many other ways to achieve the same. The key here is accessing all tables through SCHEMA.getTables().

I hope this helps,
Lukas

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages