@Override public EmpPersonalDetails updateImpl( com.rknowsys.eapp.hrm.model.EmpPersonalDetails empPersonalDetails) throws SystemException { empPersonalDetails = toUnwrappedModel(empPersonalDetails); boolean isNew = empPersonalDetails.isNew(); EmpPersonalDetailsModelImpl empPersonalDetailsModelImpl = (EmpPersonalDetailsModelImpl) empPersonalDetails; Session session = null; try { session = openSession(); if (empPersonalDetails.isNew()) { session.save(empPersonalDetails); empPersonalDetails.setNew(false); } else { session.merge(empPersonalDetails); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (isNew || !EmpPersonalDetailsModelImpl.COLUMN_BITMASK_ENABLED) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else { if ((empPersonalDetailsModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_EMPLOYEEID.getColumnBitmask()) != 0) { Object[] args = new Object[] {empPersonalDetailsModelImpl.getOriginalEmployeeId()}; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_EMPLOYEEID, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_EMPLOYEEID, args); args = new Object[] {empPersonalDetailsModelImpl.getEmployeeId()}; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_EMPLOYEEID, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_EMPLOYEEID, args); } } EntityCacheUtil.putResult( EmpPersonalDetailsModelImpl.ENTITY_CACHE_ENABLED, EmpPersonalDetailsImpl.class, empPersonalDetails.getPrimaryKey(), empPersonalDetails); return empPersonalDetails; }
protected EmpPersonalDetails toUnwrappedModel(EmpPersonalDetails empPersonalDetails) { if (empPersonalDetails instanceof EmpPersonalDetailsImpl) { return empPersonalDetails; } EmpPersonalDetailsImpl empPersonalDetailsImpl = new EmpPersonalDetailsImpl(); empPersonalDetailsImpl.setNew(empPersonalDetails.isNew()); empPersonalDetailsImpl.setPrimaryKey(empPersonalDetails.getPrimaryKey()); empPersonalDetailsImpl.setEmpPersonalDetailsId(empPersonalDetails.getEmpPersonalDetailsId()); empPersonalDetailsImpl.setEmployeeId(empPersonalDetails.getEmployeeId()); empPersonalDetailsImpl.setGroupId(empPersonalDetails.getGroupId()); empPersonalDetailsImpl.setCompanyId(empPersonalDetails.getCompanyId()); empPersonalDetailsImpl.setUserId(empPersonalDetails.getUserId()); empPersonalDetailsImpl.setCreateDate(empPersonalDetails.getCreateDate()); empPersonalDetailsImpl.setModifiedDate(empPersonalDetails.getModifiedDate()); empPersonalDetailsImpl.setFirstName(empPersonalDetails.getFirstName()); empPersonalDetailsImpl.setLastName(empPersonalDetails.getLastName()); empPersonalDetailsImpl.setMiddleName(empPersonalDetails.getMiddleName()); empPersonalDetailsImpl.setEmployeeNo(empPersonalDetails.getEmployeeNo()); empPersonalDetailsImpl.setOtherId(empPersonalDetails.getOtherId()); empPersonalDetailsImpl.setLicenseNo(empPersonalDetails.getLicenseNo()); empPersonalDetailsImpl.setLicenseExpDate(empPersonalDetails.getLicenseExpDate()); empPersonalDetailsImpl.setGender(empPersonalDetails.getGender()); empPersonalDetailsImpl.setMaritalStatus(empPersonalDetails.getMaritalStatus()); empPersonalDetailsImpl.setNationalityId(empPersonalDetails.getNationalityId()); empPersonalDetailsImpl.setDateOfBirth(empPersonalDetails.getDateOfBirth()); return empPersonalDetailsImpl; }