我们正在使用Hibernate连接到AS / 400。我们在AS / 400上遇到问题
使用LIKE
子句。
显示以下错误:
java.sql.SQLException:[SQL0131] LIKE的操作数不兼容或无效
我的查询是由Hibernate自动生成的:
select tab_parame0_.C1IMCD as C1_560_, tab_parame0_.C1NINB as C2_560_,
tab_parame0_.C1JXCD as C3_560_, tab_parame0_.C1HLTX as C4_560_, tab_parame0_.C1HMTX as C5_560_,
tab_parame0_.C1HDST as C6_560_, tab_parame0_.C1NGNB as C7_560_, tab_parame0_.C1NJNB as C8_560_,
tab_parame0_.C1NFNB as C9_560_, tab_parame0_.C1NHNB as C10_560_, tab_parame0_.C1HCST as C11_560_
from RYC1REP tab_parame0_
where lower(tab_parame0_.C1HLTX) like lower(?)
order by tab_parame0_.C1IMCD asc
fetch first 10 rows only
答案 0 :(得分:3)
SQL0131表示类型不匹配。
tab_parame0_.C1HLTX是什么数据类型?您的查询参数是什么数据类型?
请包含您的HQL / JPQL查询源代码以进行比较。
您可能必须设置SQL跟踪以确切了解AS / 400正在接收的内容。
请参阅How do I obtain trace information from my Java program using the Toolbox?
我建议您在源查询中将LIKE LOWER(:parameter)
更改为LIKE :parameter
,并在设置参数时使用.toLowerCase()
并查看其工作原理。