List of usage examples for javax.persistence.criteria CriteriaUpdate set
CriteriaUpdate<T> set(String attributeName, Object value);
From source file:com.toptal.dao.UserDaoImpl.java
@Transactional @Override//from w w w .j a v a2 s. co m public final User saveIgnoringPassword(final User user) { final CriteriaBuilder builder = this.manager.getCriteriaBuilder(); final CriteriaUpdate<User> update = builder.createCriteriaUpdate(User.class); final Root<User> root = update.from(User.class); update.set(root.get(NAME_FIELD), user.getName()); update.set(root.get("role"), user.getRole()); update.where(builder.equal(root.get("id"), user.getId())); this.manager.createQuery(update).executeUpdate(); return this.manager.find(User.class, user.getId()); }