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();

posted @ 2018-03-19 19:30  車輪の唄  阅读(11)  评论(0编辑  收藏  举报  来源