我在休眠查询中使用 CONCAT_WS 来创建一个巨大的字符串并使用like '%value%'
. 它工作正常,但对于某些记录,某些字段为空。例如,如果actId
为空,我的整个 concat_ws 返回空。我不知道为什么, concat_ws 必须忽略空值。可能是因为hibernate试图从null调用getActNumber?无论如何,我正在努力解决这个问题。
where CONCAT_WS("_", actItemId.actId.actNumber, DATE_FORMAT(recordDate, '%d.%m.%Y'), actItemId.techniqueId.name, fzkActNumber, ....etc) like '%value%'
谢谢!