java.lang.IllegalArgumentException: Positional parameter does not exist

java.lang.IllegalArgumentException: Positional parameter does not exist

Query q=s.createQuery("update  T2dMachineStore set repairCompName=? where t2d_Idno=?");
q.setString("p1",stationName);
q.setInteger("p2",Integer.parseInt(t2d_Idno[k]));

 提供两个占位符. 但其中一个参数为空.   修改成:

Query q=s.createQuery("update  T2dMachineStore set repairCompName=:p1 where t2d_Idno=:p2");
q.setString("p1",stationName);
q.setInteger("p2",Integer.parseInt(t2d_Idno[k]));
 问题解决.

你可能感兴趣的:(java)