菜鸟求助could not locate named parameter怎么解决?
Account类里面有个
@NamedQuery(name = "Account.updateBill",
query = "UPDATE Account a SET a.amount=:am WHERE a.id=:d ")
public Account updateBillAmount(int id, int amount) {
Query query = em.createNamedQuery("Account.updateBill");
query.setParameter("amount", amount);
query.setParameter("id", id);
int updateData = query.executeUpdate();
return (Account) query.getSingleResult();
}
我这么执行这个办法。。为什么会报could not locate named parameter [amount]
我试过query.setParameter(1, amount);
query.setParameter(2, id);
也不行,求助啊。。
[解决办法]
query.setParameter("am", amount);
query.setParameter("d", id);