JOOQ:The 类型 Condition 中的方法 and(Boolean) 已弃用

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

在使用 JOOQ 时,dsl.select() 和 .and() 我收到了 "The method and(Boolean) from the type Condition is deprecated" 这样的警告。我正在使用 jooq 3.8.3。 有人可以介绍一下吗?

我知道了,我用的是equals方法而不是equal,like

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

equal 的使用对我有用!!

该方法(以及许多其他类似方法)在 jOOQ 3.8 中已弃用,问题为 #4763, precisely for the reason you've experienced and

许多人在真正生成 boolean 常量时不小心使用了 Object.equals() method rather than the Field.equal() method (e.g. because of accidental IDE auto completion), believing that they are producing a valid jOOQ Condition

如果没有任何 Condition.and(Boolean) "convenience methods",你只会得到一个编译错误并修复你的错误。但是使用 Condition.and(Boolean) 方法,您的代码可以正常编译和运行,但是您的查询并没有按照您的意图执行。

因此,产生这种混乱结果的 "convenience method" 再次被弃用。

附带说明一下,您可以通过使用 Field.eq() 等两个字母的缩写形式来避免此问题。