I have a problem quering in JOOQ. How can I use signed integer type in jooq as it doesn't allow to cast it to UIntegers
. I got the error in this equal method.
public List<Movies> getMovie(int movid) {
return dsl.select().from(MOVIES).where(MOVIES.MOVIE_ID.equal(movid)).limit(1).fetch().into(Movies.class);
}
I suspect that your
MOVIE_ID
column is of typeINTEGER UNSIGNED
in your MySQL database. This is why jOOQ's code generator generated aField<UInteger>
for it. You have three options:1. Keep using unsigned integers
You'll have to convert your
movid
variable to anUInteger
:... or:
2. Stop using unsigned integers in jOOQ
You can instruct the jOOQ code generator not to generate unsigned integers.
Alternatively, you can also use
<forcedTypes/>
in the code generator configuration to enforce unsigned types for individual columns.For details, see the relevant section in the manual
3. Stop using unsigned integers in the database
Another option is to stop using
UNSIGNED
data types in the database, if you prefer to use signed types, of course.