Example #1
0
 /*
  * Since the method is running with Transaction, No need to call hibernate update explicitly.
  * Just fetch the entity from db and update it with proper values within transaction.
  * It will be updated in db once transaction ends.
  */
 public void updateEmployee(Employee employee) {
   Employee entity = dao.findById(employee.getId());
   if (entity != null) {
     entity.setName(employee.getName());
     entity.setJoiningDate(employee.getJoiningDate());
     entity.setSalary(employee.getSalary());
     entity.setSsn(employee.getSsn());
   }
 }
Example #2
0
 public boolean isEmployeeSsnUnique(Integer id, String ssn) {
   Employee employee = findEmployeeBySsn(ssn);
   return (employee == null || ((id != null) && (employee.getId() == id)));
 }