/* * 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()); } }
public Employee findEmployeeBySsn(String ssn) { return dao.findEmployeeBySsn(ssn); }
public List<Employee> findAllEmployees() { return dao.findAllEmployees(); }
public void deleteEmployeeBySsn(String ssn) { dao.deleteEmployeeBySsn(ssn); }
public void saveEmployee(Employee employee) { dao.saveEmployee(employee); }
public Employee findById(int id) { return dao.findById(id); }