I have simpler examples where using a multiset works fine, however I am now nesting it in a CTE and JOOQ seems to be converting it to an array rather than keeping it as a record.
This is about as simple as an example as I can get:
val table = DSL.select(
PROXY_VOTE.asterisk(),
multiset(
DSL.selectFrom(TAG)
.where(TAG.PROXY_VOTE_ID.eq(PROXY_VOTE.ID))
)
.`as`("tags"),
)
.from(PROXY_VOTE)
val cte = with("cte").`as`(table)
.select(
asterisk(),
DSL.count().over().`as`("total_count")
).from(name("cte"))
val results = this
.with("cte2").`as`(cte)
.select()
.from("cte2")
.fetch()
If you then do this:
results.first().getValue("tags", List::class.java)
You’ll see that you get back json arrays instead of TagRecord
s. I don’t mind converting them back to TagRecord
s myself, however I’m not sure how you do that in an automatic way (all I seem to find is manually mapping each field, which is a no go).
Any help would be appreciated, thanks.
Niamh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.