Reputation: 2148
I'm trying to update my entity class, but I am getting :
javax.persistence.PersistenceException: Only select and delete statements are supported.
this exact code worked fine when i wasn't using Google app engine. My code is:
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();
So I'm asking how can I update the entity query?
Upvotes: 2
Views: 1271
Reputation: 15577
Since the GAE datastore doesn't support a query that updates fields in the datastore directly, then you similarly cannot do that via the JPA API. Since JPA was never designed for other types of datastores then you will see features that are inapplicable.
Retrieve the objects via query, and update them manually.
When GAE provides full map-reduce out-of-the-box then something like that would be viable to support
Upvotes: 2