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:
Any ideas what I am doing wrong?