delete语句执行createQuery的时候,不能传对象类
一:错误写法
String hql = " delete from T_ST_CircuitMeterInfo e where e.circuitID = ?";
Query query = em.createQuery(hql, T_ST_CircuitMeterInfo.class);
query.setParameter(1, circuitID);
int count = query.executeUpdate();
二:正解
String hql = " delete from T_ST_CircuitMeterInfo e where e.circuitID = ?";
Query query = em.createQuery(hql);
query.setParameter(1, circuitID);
int count = query.executeUpdate();