List of usage examples for org.springframework.transaction.annotation Isolation READ_COMMITTED
Isolation READ_COMMITTED
To view the source code for org.springframework.transaction.annotation Isolation READ_COMMITTED.
Click Source Link
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public List<E> findListByParams2(Map<String, Object> params, Map<String, String> likeParams, Map<String, CustomeOperational> customOperParams, Map<String, String> orderParams) throws ServiceException, Exception { return this.getBaseDataAccessObject().findListByParams2(params, likeParams, customOperParams, orderParams); }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@SuppressWarnings("unchecked") @ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public List<T> findListVOByParams(Map<String, Object> params) throws ServiceException, Exception { List<T> returnList = null; List<E> searchList = findListByParams(params, null); if (searchList == null || searchList.size() < 1) { return returnList; }//from www .j a va 2 s . com returnList = new ArrayList<T>(); for (E entity : searchList) { Class<T> objectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0); T obj = objectClass.newInstance(); this.doMapper(entity, obj, this.getMapperIdPo2Vo()); returnList.add(obj); } return returnList; }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) @SuppressWarnings("unchecked") public DefaultResult<T> findByUK(T object) throws ServiceException, Exception { if (object == null || !(object instanceof BaseValueObj)) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }//from ww w .j ava 2s. c om Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0); Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1); E entityObject = entityObjectClass.newInstance(); T objectByUK = null; try { this.doMapper(object, entityObject, this.getMapperIdVo2Po()); E entityByUK = this.getBaseDataAccessObject().findByUK(entityObject); if (entityByUK != null) { objectByUK = valueObjectClass.newInstance(); this.doMapper(entityByUK, objectByUK, this.getMapperIdPo2Vo()); } } catch (Exception e) { e.printStackTrace(); } DefaultResult<T> result = new DefaultResult<T>(); if (objectByUK != null && !StringUtils.isBlank(((BaseValueObj) objectByUK).getOid())) { result.setValue(objectByUK); } else { result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA))); } return result; }
From source file:com.inkubator.hrm.service.impl.TempAttendanceRealizationServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void executeBatchFileUpload(TempAttendanceRealizationViewModel model) throws Exception { //Boolean isInsertable = this.payTempUploadDataDao.getEntityByNikAndComponentId(model.getNik(), model.getPaySalaryComponentId()) == null; Boolean isInsertable = Boolean.TRUE; //skip jika data sudah ada di database(tidak boleh duplikat) if (isInsertable) { EmpData empData = empDataDao.getEntiyByPK(model.getEmpId()); WtGroupWorking wtGroupWorking = wtGroupWorkingDao.getEntiyByPK(model.getWtGroupWorkingId()); WtPeriode wtPeriode = wtPeriodeDao.getEntiyByPK(model.getWtPeriodId()); if (empData != null) { TempAttendanceRealization entity = new TempAttendanceRealization(); entity.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); entity.setAttendanceDaysPresent(model.getAttendanceDaysPresent()); entity.setAttendanceDaysSchedule(model.getAttendanceDaysSchedule()); entity.setCreatedBy(model.getCreatedBy()); entity.setCreatedOn(new Date()); entity.setDuty(model.getDuty()); entity.setEmpData(empData);/*from www. j a va 2 s .c o m*/ entity.setLeave(model.getLeaves()); entity.setOvertime(model.getOverTime()); entity.setPermit(model.getPermit()); entity.setSick(model.getSick()); entity.setWtGroupWorking(wtGroupWorking); entity.setWtPeriod(wtPeriode); this.tempAttendanceRealizationDao.save(entity); } } }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) @SuppressWarnings("unchecked") public int countByUK(T object) throws ServiceException, Exception { if (object == null || !(object instanceof BaseValueObj)) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }//from w w w . ja v a 2 s . co m int count = 0; Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1); E entityObject = entityObjectClass.newInstance(); try { this.doMapper(object, entityObject, this.getMapperIdVo2Po()); count = this.getBaseDataAccessObject().countByUK(entityObject); } catch (Exception e) { e.printStackTrace(); } return count; }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public E findByEntityUK(E entityObject) throws ServiceException, Exception { if (entityObject == null || !(entityObject instanceof BaseEntity)) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }/*from w w w .j a v a 2 s . c o m*/ Map<String, Object> ukMap = BaseEntityUtil.getUKParameter((BaseEntity<?>) entityObject); if (ukMap == null || ukMap.size() < 1) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_INCORRECT)); } return this.getBaseDataAccessObject().findByEntityUK(ukMap); }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT }) @Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public int countByEntityUK(E entityObject) throws ServiceException, Exception { if (entityObject == null || !(entityObject instanceof BaseEntity)) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }/* w w w . j a v a 2 s .c om*/ Map<String, Object> ukMap = BaseEntityUtil.getUKParameter((BaseEntity<?>) entityObject); if (ukMap == null || ukMap.size() < 1) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_INCORRECT)); } return this.getBaseDataAccessObject().countByEntityUK(ukMap); }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public DefaultResult<List<E>> ibatisSelectListByParams(Map<String, Object> params) throws ServiceException, Exception { if (params == null) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }//www . jav a2s .c om DefaultResult<List<E>> result = new DefaultResult<List<E>>(); List<E> searchList = (List<E>) this.getBaseDataAccessObject().ibatisSelectListByParams(params); if (searchList != null && searchList.size() > 0) { result.setValue(searchList); } else { result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA))); } return result; }
From source file:com.inkubator.hrm.service.impl.LoanNewApplicationServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void cancelLoanApplicationAndSaveToLoanNewCancellation( LoanNewCancellationFormModel loanNewCancellationFormModel) throws Exception { Long actvityId = loanNewCancellationFormModel.getLoanPendingActivity(); ApprovalActivity approvalActivity = approvalActivityDao.getEntityByPkWithDetail(actvityId); //check if there is already approved by someone(approver), then it shouldn't be cancelled if (approvalActivityDao.isAlreadyHaveApprovedStatus(approvalActivity.getActivityNumber())) { throw new BussinessException("approval.error_cancelled_already_approved"); }// w w w . j av a 2s. co m String activityNumber = approvalActivity.getActivityNumber(); /** saving entity LoanApplication to DB */ LoanNewApplication application = this.convertJsonToEntity(approvalActivity.getPendingData()); application.setLoanStatus(HRMConstant.LOAN_CANCELED); // set cancelled application status application.setApprovalActivityNumber(activityNumber); //set approval activity number, for history approval purpose this.save(application, Boolean.TRUE, null); //Save LoanNewCancellation log LoanNewCancelation loanNewCancelation = new LoanNewCancelation(); loanNewCancelation.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); loanNewCancelation.setApprovalActivityNumber(activityNumber); loanNewCancelation.setLoanNewApplication(application); loanNewCancelation.setEmpData(empDataDao.getEntiyByPK(loanNewCancellationFormModel.getEmpData().getId())); loanNewCancelation.setLoanNewSchema( loanNewSchemaDao.getEntiyByPK(loanNewCancellationFormModel.getLoanNewSchema().getId())); loanNewCancelation .setLoanNewType(loanNewTypeDao.getEntiyByPK(loanNewCancellationFormModel.getLoanNewType().getId())); loanNewCancelation.setLoanCancellationNumber(this.generateLoanCancelationNumber()); loanNewCancelation.setLoanNumber(loanNewCancellationFormModel.getLoanNumber()); loanNewCancelation.setReason(loanNewCancellationFormModel.getReasonCancellation()); loanNewCancelation.setCancelationDate(loanNewCancellationFormModel.getLoanCancellationDate()); loanNewCancelation.setCreatedOn(new Date()); loanNewCancelation.setCreatedBy(UserInfoUtil.getUserName()); LoanNewCancelationDao.save(loanNewCancelation); /** cancel this approval activity and saving log approver history */ LoanNewSchemaListOfEmp loanNewSchemaListOfEmp = loanNewSchemaListOfEmpDao .getEntityWithDetailByEmpDataId(application.getEmpData().getId()); LoanNewSchema loanNewSchema = loanNewSchemaDao .getEntityByPkFetchApprovalDefinition(loanNewSchemaListOfEmp.getLoanNewSchema().getId()); List<ApprovalDefinition> appDefs = Lambda.extract(loanNewSchema.getApprovalDefinitionLoanSchemas(), Lambda.on(ApprovalDefinitionLoan.class).getApprovalDefinition()); super.cancelled(actvityId, loanNewCancellationFormModel.getReasonCancellation(), appDefs); }
From source file:com.netsteadfast.greenstep.base.service.BaseService.java
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true) public DefaultResult<E> ibatisSelectOneByValue(E valueObj) throws ServiceException, Exception { if (null == valueObj) { throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL)); }/*from w w w. j a va 2s . co m*/ DefaultResult<E> result = new DefaultResult<E>(); E searchResult = this.getBaseDataAccessObject().ibatisSelectOneByValue(valueObj); if (searchResult != null) { result.setValue(searchResult); } else { result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA))); } return result; }