admin管理员组文章数量:1123592
I have simple query:
/* crm_person */
select /*query crm_person*/
crm_pers.*
from crm_person crm_pers
where 1=1
and crm_pers.id = ?
And params map:
As result I am getting error - org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = character varying Hint: No operator matches the given name and argument types. You might need to add explicit type casts. Position: 133
I have simple query:
/* crm_person */
select /*query crm_person*/
crm_pers.*
from crm_person crm_pers
where 1=1
and crm_pers.id = ?
And params map:
As result I am getting error - org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = character varying Hint: No operator matches the given name and argument types. You might need to add explicit type casts. Position: 133
Share Improve this question asked 21 hours ago GintsGintsGintsGints 8351 gold badge7 silver badges15 bronze badges 5 |2 Answers
Reset to default 0As the error states, the column is a (big) integer, which should be equivalent to Java's long. Instead of using setObject
with a string, you can use setLong
:
ps.setLong(1, Long.parseLong(param);
For me problem was groovy script, which set parameter id as string if not specified:
def params = utils.queries.params().put("id", personId).getMap()
so this helped:
def params = utils.queries.params().put("id", personId as Long).getMap()
本文标签:
版权声明:本文标题:java - Simple query fails with: operator does not exist: bigint = character varying with Postgres jdbc - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736580660a1944946.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
crm_pers.id::varchar
to make the types match. – AymDev Commented 21 hours agops.setObject(bindedParamsCount++, param);
– GintsGints Commented 21 hours ago