Search code examples
jooq

Setting a bitwise column with jooq in mysql


I'm trying to do a bitwise operation while setting a column using JOOQ and MySQL. The statement I'm trying to convert to JOOQ is:

UPDATE users SET permission = permission | 16;

Is there a way todo this in JOOQ?


Solution

  • Use DSL.bitOr()

    ctx.update(USERS)
       .set(USERS.PERMISSION, bitOr(USERS.PERMISSION, 16))
       .execute();