postgresql 运算符不存在:bigint = bytea
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9065154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-20 23:35:13 来源:igfitidea点击:
operator does not exist: bigint = bytea
提问by Naveen A
Here is my code:
这是我的代码:
List<Long> ids= new ArrayList<Long>();
ids.add(10L);ids.add(11L);
String queryString ="select type_id from Types where parent_type_id in (:typeIds)";
SQLQuery sqlQuery = session.createSQLQuery(queryString);
sqlQuery.setParameter("typeIds", ids);
List<Object[]> results = sqlQuery.list();
I am getting this error while executing the above query. FYI, I just saw this issue when I passed an array or ArrayList as paramter.
执行上述查询时出现此错误。仅供参考,当我将数组或 ArrayList 作为参数传递时,我刚刚看到了这个问题。
ERROR util.JDBCExceptionReporter: ERROR: operator does not exist:
bigint = bytea Exception in thread "main"
org.hibernate.exception.SQLGrammarException: could not execute query
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
回答by Naveen A
query.setParameterList("typeIds",ids);
It got resolved using setParameterList();
它得到解决使用 setParameterList();
回答by Jan Nielsen
You will get this same error if null == ids
.
如果null == ids
.