我已经从数据库中生成了许多JOOQ类。我想按客户轻松过滤表,同时保持表的强类型。
这就是我想要做的:
// Generated class books
JBooks books = JBooks.BOOKS;
// get ownershipCheck (this could be more complicated, possibly joining multiple tables)
Condition ownershipCheck = books.customer().ID.eq(currentCustomer);
// desired output that I can do further operations on
JBooks filteredBooks = selectFrom(books).where(ownershipCheck).asTable();
// a bunch of random operations using the functionality from JBooks
db.select(filteredBooks.AUTHOR, filteredBooks.PUBLISH_DATE, ...etc)
很遗憾,我不能这样做。我得到一个Table<JBooksRecord>
,但看不到将新表转换为JBooks