S.
08/16/2022, 9:04 PMQueryDsl.from(decks).where(declaration).orderBy(decks.id.asc()).limit(pageSize)
.leftJoin(deckWords) { decks.id eq deckWords.deck }
.leftJoin(deckTags) { decks.id eq deckTags.deck }
.include(decks, deckWords, deckTags)
the issue here is that it also limits joined tables. is it possible to add subqueries with the dsl to circumvent this?Toshihiro Nakamura
08/16/2022, 11:20 PMval decks2 = decks.clone()
val subquery = QueryDsl.from(decks2).where(declaration).orderBy(decks2.id.asc()).limit(pageSize).select(decks2.id)
QueryDsl.from(decks).where { decks.id inList subquery }.orderBy(decks.id.asc())
.leftJoin(deckWords) { decks.id eq deckWords.deck }
.leftJoin(deckTags) { decks.id eq deckTags.deck }
.include(decks, deckWords, deckTags)
You can also define decks2
using aliases instead of cloning decks
. Please refer to the documentation for more information about aliases:
https://www.komapper.org/docs/reference/entity-class/#metamodel-aliasesS.
08/17/2022, 12:12 AM