我从我的数据库生成了许多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