一:错误写法
String hql = " delete from T_ST_CircuitMeterInfo e where e.circuitID = ?";
Query query = em.createQuery(hql, T_ST_CircuitMeterInfo.class);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();
delete语句执行createQuery的时候,不能传对象类。
java.lang.IllegalArgumentException: Update/delete queries cannot be typed
原文地址:http://blog.csdn.net/u013628152/article/details/45270819