Hi Juan, Thanks for your message. I don't see anything wrong in your example code. You might have omitted some additional detail that is relevant here? For example, why is your data class property "id" highlighted in red, and not written in italics?
If you think this is a bug, maybe our MCVE template could help reproduce this easily in a "mimimal, complete, verifiable example" (MCVE): https://github.com/jOOQ/jOOQ-mcve. If it's not a bug, this might also help you track down the problem on your end. Best Regards, Lukas On Sun, Sep 3, 2023 at 11:04 AM Juan Jose <[email protected]> wrote: > Hey, > > I am new to JOOQ and I love it so far. I plan to migrate a quarkus > hibernate application to JOOQ to get more control over the queries executed > against my postgres database. > > I however don't know what happens in the following example with my > generated ID field. It doesn't get mapped into my POJOS: > > This is my user table: > create table if not exists "user" > ( > id bigint primary key generated always as identity, > created_at timestamp with time zone default now() not null, > keycloak_id varchar(36) not null unique, > username varchar(255) not null unique > ); > > And this is my POJO: > > data class User( > val id: Long? = null, > var keycloakId: String = "", > var createdAt: OffsetDateTime? = null, > var username: String = "", > ) > > And I have some logic to get a user by id: > fun loadUserById(id: Long): User { > with(db.dslContext) { > return select() > .from(USER).where(USER.ID.eq(id)) > .fetchOne()?.into(User::class.java) > ?: throw RuntimeException("User with $id not found") > } > } > > This fetches the user and i can see that the id is being set in the > record. But it doesn't get mapped to my User POJO, all other columns are > mapped properly: > > [image: pojo_mapping.png] > > Any ideas what I am doing wrong? > > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/31df1045-f6e9-49a2-9aa0-63a23b8bd218n%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/31df1045-f6e9-49a2-9aa0-63a23b8bd218n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO4q_q%3DOAonLrVc2ZBVaPQp%2BvkCF1fqFF7fsv7CcO1SMeQ%40mail.gmail.com.
