赞
踩
最近公司项目涉及到了自动建表这一块,查询的时候也就只能动态生成sql使用JdbcTemplate进行查询,在模糊查询时使用.append(" like '%?%' ") 是识别不到占位符的,.append(" like '%'?'%' ")也是报错,使用.append(" like CONCAT('%',?,'%') ")则识别不到参数类型,
ERROR: could not determine data type of parameter $2
通过指定类型解决。
最终的解决方案是.append(" like CONCAT('%',?::varchar,'%') ")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。