当前位置: 首页 > 知识库问答 >
问题:

java.sql.sqlException:ORA-00932:不一致的数据类型:预期的数字是二进制的

董高朗
2023-03-14
public List<Object[]> getListByCustomer(Session session, int customerId, List<Integer> strIds) {
  Query namedQuery = session.createSQLQuery(QueryConstants.EXPORT);
  namedQuery.setParameter("customer", customerId);
  namedQuery.setParameter("stringId", strIds);
  List<Object[]> objects = namedQuery.list();
  return objects;
}
public class QueryConstants {
  public static final String EXPORT = 
    "SELECT sv.NAME, sv.TYPE, sv.CLIENT_ADDRESS, sv.NAME_REDUNDANT, sv.DEPARTURE_DATE, s1.CODE,sv.STATE, sv.CODE "
    + "FROM VIEW sv, PROCESS p1, SET s1 " 
    + "WHERE sv.R_ID = p1.R_ID and p1.ISSUER_ID = s1.USER_ID and sv.CUSTOMER_ID = :customer and sv.R_ID IN (:stringId)";
}

共有1个答案

高琛
2023-03-14

我想你只需要用

 IN :stringId

而不是

 IN (:stringId)

对于JPA

namedQuery.setParameter("stringId", strIds);
namedQuery.setParameterList("stringId", strIds);
 类似资料: