Try to search your question here, if you can't find : Ask Any Question Now ?

Filter a JOOQ generated table with a condition while maintaining type

HomeCategory: stackoverflowFilter a JOOQ generated table with a condition while maintaining type
bhawya asked 2 weeks ago

I have generated a number of JOOQ classes from my database. I want to easily filter my tables by customer while maintaining the strong type of my tables.

This is what I want to be able to do:

// 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)

Unfortunately, I can’t do this. I get a Table<JSubscriberUsageCdrRecord> instead and I see no way to cast my new Table to JBooks

1 Answers
Best Answer
Arben answered 2 weeks ago
Your Answer

7 + 15 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com