javaWeb->hql->in这个怎么做才是对的呀 StringBuilder hql = new StringBuilder("from Trade where ") .append("shop = ? ") .append("and workStatus in (?) "); List<Object> paramsList = new ArrayList<Object>(); paramsList.add(trade.getShop());
List<WorkStatus> workStatusList = new ArrayList<WorkStatus>(); workStatusList.add(WorkStatus.CLIENT); workStatusList.add(WorkStatus.FINANCIAL); paramsList.add(workStatusList);//paramsList.add(workStatusList);后面这个也不行
tradeDao.findByHql(hql.toString(), paramsList.toArray()); 报的异常都是in后面的这个?的类型转换错误。 java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Enum 用注释掉的会报 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.Enum at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:148)