参数下标是从1开始还是0开始,你这个没问题的话, 把() 去掉,直接 in ? 试试

解决方案 »

  1.   


    参数下标是从1开始的把() 去掉后,报错:Hibernate: select user_id,count(1) cases_count from ts_topics where status=0 and user_id in ? group by user_id
    09:46:47.768 [http-nio-9060-exec-1] WARN  org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 42601
    09:46:47.769 [http-nio-9060-exec-1] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - 错误: 语法错误 在 "$1" 或附近的
      位置:83
    09:46:47.799 [http-nio-9060-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
    org.postgresql.util.PSQLException: 错误: 语法错误 在 "$1" 或附近的
      位置:83
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) ~[postgresql-9.1-901.jdbc4.jar:na]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) ~[postgresql-9.1-901.jdbc4.jar:na]