I have 3 ways things get written to the DB
public void create(T object) {
entityManager.persist(object);
}
public void update(T object) {
object = e
Try this -
public int updateStatus(String id, String status) {
final int changes =
entityManager.createQuery("Update Item set state = :newState," +
" lastModified = CURRENT_TIMESTAMP" +
" where id = : id ")
.setParameter("newState", status)
.setParameter("id", id)
.executeUpdate();
return changes;
}
Following link wiil help you to learn more about JPQL -
http://docs.oracle.com/javaee/6/tutorial/doc/bnbtg.html