我正在尝试更新我的实体类,但我得到:
javax.persistence.PersistenceException: Only select and delete statements are supported.
当我不使用 Google 应用引擎时,这个确切的代码运行良好。我的代码是:
em.getTransaction().begin();
Query query =
em.createQuery("UPDATE Profile p" +
"SET p.age = 1 " +
"WHERE p.email = :email" );
query.setParameter("newPoint", point);
query.setParameter("email", email);
int updateCount = query.executeUpdate();
em.getTransaction().commit();
所以我问我如何更新实体查询?