我要运行查询以进行更新
更新 sensor_mediation_status 设置(sensor_ip,DESKTOP-5KM9TE2), 设置(last_item,890343480932434390) 哪里 table = audio;
entityTransaction.begin();
CriteriaUpdate<SensorMediationStatus> update = criteria.createCriteriaUpdate(SensorMediationStatus.class);
Root<SensorMediationStatus> from1 = update.from(SensorMediationStatus.class);
ParameterExpression<String> table = criteria.parameter(String.class);
update.set("last_item", lastItem.get(0));
update.set("sensor_ip",lastip.get(0));
update.where(criteria.equal(from1.get("table"),table));
entityManager.createQuery(update).setParameter(table, "audio").executeUpdate();
entityTransaction.commit();```
答案 0 :(得分:0)
将名称分配给ParameterExpression
应该可以解决问题:
ParameterExpression<String> table = criteria.parameter(String.class, "tableParam");