Issue
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.
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)
Solution
query.setParameterList("typeIds",ids);
It got resolved using setParameterList();
Answered By - Naveen A
Answer Checked By - Katrina (JavaFixing Volunteer)