You can use the built-in JSON_VALUE()
support of jOOQ:
ctx.selectFrom(EMPLOYEE)
.where(cast(jsonValue(EMPLOYEE.ADDRESS, "$.city"), VARCHAR).eq("Mumbai"))
.fetch();
This is assuming you use code generation and have the usual static imports:
import static org.jooq.impl.DSL.*;
import static org.jooq.impl.SQLDataType.*;
If you need support for any other vendor-specific JSON function that jOOQ doesn't support (yet), use plain SQL templating instead.
However, that approach is unlikely to take advantage of indexes, so if you can, I suggest normalising this data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.