2012-01-30 193 views
2

这里是我的代码:操作符不存在:BIGINT = BYTEA

 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(); 

在执行上面的查询,我得到这个错误。仅供参考,当我传递数组或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) 
+1

query.setParameterList( “typeIds”,IDS)它得到了解决; 它得到了解决:) – 2012-01-30 14:34:43

+0

发布它作为答案并接受它。所以每个人都可以看到它马上就解决了。 – 2012-01-30 14:43:32

回答

4
query.setParameterList("typeIds",ids); 

使用setParameterList();