Hibernate doesn\'t delete my row:
public boolean deleteVote(Login user, int pid){
Session session = getSession();
try{
String hql = \"del
full java code with HQL & session.update
try {
try (Session session = this.sessionFactory.openSession()) {
session.beginTransaction();
String hql = "UPDATE Employee SET " +
"firstName = :firstName, " +
"lastName = :lastName," +
"gender = :gender," +
"jobTitle = :jobTitle," +
"departmentId = :departmentId " +
"where employeeId = :employeeId";
Query query = session.createQuery(hql);
query
.setParameter("employeeId", employee.getEmployeeId())
.setParameter("departmentId", employee.getDepartmentId())
.setParameter("firstName", employee.getFirstName())
.setParameter("lastName", employee.getLastName())
.setParameter("gender", employee.getGender())
.setParameter("jobTitle", employee.getJobTitle())
;
int rows = query.executeUpdate();
// session.update(Objects.requireNonNull(employee));
session.getTransaction().commit();
return session.get(Employee.class, employee.getEmployeeId()).equals(employee);
}
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
}