From what I know, UPDATE and DELETE can be done by NamedQueries.
However,
void updateName (int ID, String name) {
EntityManager entityManager =
Persistence.createEntityManagerFactory("uPU").createEntityManager();
Query query = entityManager.createNamedQuery("Users.updateName");
query.setParameter("name", name);
query.setParameter("id", ID);
}
isn't doing the update.
The named query is as follows:
@NamedQuery(name = "Users.updateName", query = "UPDATE Users u SET u.name = :name "
+ "WHERE u.id = :id "),
A similar thing going on with DELETE.
Nothing wrong with SELECT on Namedqueries.
Is there something more to altering the contents of an SQL table with NamedQueries?
//================================
ADD:
i'm using a namedquery.
From what I know, opening the transaction and commiting it is not necessary on namedQueries.
query.executeUpdate();
gives a runtime error.
//================================
ADD2:
The code is giving no compile or runtime errors except to that addition suggested by DataNucleus below. see my previous edition above regarding that suggestion.