简体   繁体   中英

JOOQ:The method and(Boolean) from the type Condition is deprecated

While using JOOQ, dsl.select() with .and() I got "The method and(Boolean) from the type Condition is deprecated" such kind of warning. Iam using jooq 3.8.3. Does anybody can brief me about this?

I got it, I was using equals method instead of equal,like

.where(AePlan.AE_PLAN.PLAN_ID**.equals**(planId)
.and(AePlan.AE_PLAN.PHARMACYNETWORK_ID.**equals**(pharmacyNW_Id))

Use of equal is worked for me!!

That method (and many other similar methods) were deprecated in jOOQ 3.8 with issue #4763 , precisely for the reason you've experienced and documented yourself in your own answer .

Many people accidentally used the Object.equals() method rather than the Field.equal() method (eg because of accidental IDE auto completion), believing that they are producing a valid jOOQ Condition , when they were really producing a boolean constant.

If there wasn't any Condition.and(Boolean) "convenience methods", you would have simply gotten a compilation error and fixed your mistake. But with the Condition.and(Boolean) method, your code compiles and runs fine, but your query doesn't do what you intentioned.

Thus the "convenience method" that produced this confusing results was deprecated again.

On a side-note, you can avoid this problem by using the two-letter abbreviated forms like Field.eq() instead.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM