Jooq how to query entity based on composite key
Asked Answered
C

1

5

How to query an entity based on a composite key in Jooq? E.g.:

UserAttempts org.jooq.impl.DAOImpl.findById(Record2<UInteger, String> id)

id is a composite key. How to use the Record2<UInteger, String>?

Cherub answered 27/1, 2017 at 6:43 Comment(0)
V
8

You can construct a Record2 using DSLContext.newRecord():

UserAttempts attempts =
dao.findById(ctx.newRecord(USER_ATTEMPTS.ID_COLUMN1, USER_ATTEMPTS.ID_COLUMN2)
                .values(uint(1), "abc"));
Vituperation answered 27/1, 2017 at 10:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.