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:org.alienlabs.hatchetharry.persistence.dao.CollectibleCardDaoImpl.java
/** * Save the CollectibleCard to the DB/*from w ww . j av a 2 s . c o m*/ * * @param CollectibleCard * @return persistent instance of CollectibleCard */ @Override @Transactional(isolation = Isolation.READ_COMMITTED) public Long save(final CollectibleCard collectibleCard) { return (Long) this.getSession().save(collectibleCard); }
From source file:org.alienlabs.hatchetharry.persistence.dao.DeckDaoImpl.java
/** * Save the Deck to the DB/*from w w w.jav a 2s. c o m*/ * * @param Deck * @return persistent instance of Deck */ @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) public Deck save(final Deck Deck) { return (Deck) this.getSession().merge(Deck); }
From source file:com.inkubator.hrm.service.impl.LoginHistoryServiceImpl.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) public void update(LoginHistory entity) throws Exception { LoginHistory loginHistory = this.loginHistoryDao.getEntiyByPK(entity.getId()); loginHistory.setLogOutDate(new Date()); this.loginHistoryDao.update(loginHistory); }
From source file:org.alienlabs.hatchetharry.persistence.dao.ArrowDaoImpl.java
/** * Delete a {@link Arrow} from the DB, given it's <tt>id</tt>. * //from ww w . j a v a2 s.c om * @param id * The id of the Arrow to delete. */ @Override @Transactional(isolation = Isolation.READ_COMMITTED) public void delete(final long id) { this.getSession().delete(this.load(id)); }
From source file:com.inkubator.hrm.service.impl.JadwalKerjaMassMessagesListener.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { try {//from w ww . j a v a 2s. c o m TextMessage textMessage = (TextMessage) message; JSONObject jSONObject = new JSONObject(textMessage.getText()); long workingGroupId = Long.parseLong(jSONObject.getString("groupWorkingId")); String listEmp = jSONObject.getString("listEmpId"); Date createOn = new SimpleDateFormat("dd-MM-yyyy hh:mm").parse(jSONObject.getString("createDate")); String createBy = jSONObject.getString("createBy"); Gson gson = new GsonBuilder().create(); // List<TempJadwalKaryawan> dataToDelete = new ArrayList<>(); TypeToken<List<Long>> token = new TypeToken<List<Long>>() { }; List<Long> dataEmpId = gson.fromJson(listEmp, token.getType()); //Date now = new Date(); WtGroupWorking groupWorking = wtGroupWorkingDao.getEntiyByPK(workingGroupId); Date startDate = groupWorking.getBeginTime();//tidak ditempatkan di dalam loop karena untuk groupworking yang sama Date endDate = groupWorking.getEndTime(); int numberOfDay = DateTimeUtil.getTotalDayDifference(startDate, endDate); int totalDateDif = DateTimeUtil.getTotalDayDifference(startDate, createOn) + 1; int num = numberOfDay + 1; int hasilBagi = (totalDateDif) / (num); Date tanggalAkhirJadwal = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num) - 1, CommonUtilConstant.DATE_FORMAT_DAY); // String dayBegin = new SimpleDateFormat("EEEE").format(endDate); // String dayNow = new SimpleDateFormat("EEEE").format(now); Date beginScheduleDate; if (new SimpleDateFormat("ddMMyyyy").format(tanggalAkhirJadwal) .equals(new SimpleDateFormat("ddMMyyyy").format(new Date()))) { beginScheduleDate = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num) - num, CommonUtilConstant.DATE_FORMAT_DAY); } else { beginScheduleDate = DateTimeUtil.getDateFrom(startDate, (hasilBagi * num), CommonUtilConstant.DATE_FORMAT_DAY); } List<TempJadwalKaryawan> dataToSave = new ArrayList<>(); TempJadwalKaryawan jadwalKaryawan; for (Long id : dataEmpId) { // dataToDelete.addAll(tempJadwalKaryawanDao.getAllByEmpId(id)); for bussiner process Sake so must be close List<WtScheduleShift> dataScheduleShift = new ArrayList<>(groupWorking.getWtScheduleShifts()); // Collections.sort(dataScheduleShift, shortByDate1); List<WtScheduleShift> sortedDataScheduleShift = Lambda.sort(dataScheduleShift, Lambda.on(WtScheduleShift.class).getScheduleDate()); int i = 0; for (WtScheduleShift wtScheduleShift : sortedDataScheduleShift) { String onlyDate = new SimpleDateFormat("yyyy-MM-dd").format( DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); Date olnyDate = new SimpleDateFormat("yyyy-MM-dd").parse(onlyDate); jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(id, olnyDate); if (jadwalKaryawan != null) { jadwalKaryawan.setUpdatedBy(createBy); jadwalKaryawan.setUpdatedOn(new Date()); // jadwalKaryawan = tempJadwalKaryawanDao.getByEmpId(empData.getId(), olnyDate); } else { jadwalKaryawan = new TempJadwalKaryawan(); jadwalKaryawan.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(12))); jadwalKaryawan.setEmpData(empDataDao.getEntiyByPK(id)); jadwalKaryawan.setTanggalWaktuKerja( DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); jadwalKaryawan.setCreatedBy(createBy); jadwalKaryawan.setCreatedOn(createOn); } // TempJadwalKaryawan jadwalKaryawan = new TempJadwalKaryawan(); // jadwalKaryawan.setEmpData(empDataDao.getEntiyByPK(id)); // jadwalKaryawan.setTanggalWaktuKerja(DateTimeUtil.getDateFrom(beginScheduleDate, i, CommonUtilConstant.DATE_FORMAT_DAY)); // jadwalKaryawan.setWtWorkingHour(wtScheduleShift.getWtWorkingHour()); WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(jadwalKaryawan.getTanggalWaktuKerja()); if (holiday != null && groupWorking.getTypeSequeace().equals(HRMConstant.NORMAL_SCHEDULE)) { jadwalKaryawan.setWtWorkingHour(wtWorkingHourDao.getByCode("OFF")); } else { jadwalKaryawan.setWtWorkingHour(wtScheduleShift.getWtWorkingHour()); } // WtHoliday holiday = wtHolidayDao.getWtHolidayByDate(jadwalKaryawan.getTanggalWaktuKerja()); // if (holiday != null || wtScheduleShift.getWtWorkingHour().getCode().equalsIgnoreCase("OFF")) { // jadwalKaryawan.setAttendanceStatus(attendanceStatusDao.getByCode("OFF")); // } else { // jadwalKaryawan.setAttendanceStatus(attendanceStatusDao.getByCode("HD1")); // } jadwalKaryawan.setIsCollectiveLeave(Boolean.FALSE); dataToSave.add(jadwalKaryawan); i++; } } // tempJadwalKaryawanDao.deleteBacth(dataToDelete); tempJadwalKaryawanDao.saveBatch(dataToSave); //sending email process this.sendingEmailJadwalKaryawan(dataToSave, jSONObject.getString("locale")); } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:com.inkubator.hrm.service.impl.BioSertifikasiServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(BioSertifikasi t) throws Exception { this.bioSertifikasiDao.save(t); }
From source file:com.inkubator.sms.gateway.service.impl.ModemDefinitionServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(ModemDefinition entity) throws Exception { long totalDuplicate = this.modemDefinitionDao.getTotalByModemIdAndNotId(entity.getModemId(), entity.getId());//from w w w . j av a 2s. co m if (totalDuplicate > 0) { throw new BussinessException("Data dengan modem id :" + entity.getModemId() + " telah ada di database. Silahkan pilih modem id yang lain"); } ModemDefinition definition = this.modemDefinitionDao.getEntiyByPK(entity.getId()); definition.setBaudRate(entity.getBaudRate()); definition.setComId(entity.getComId()); definition.setCurrentValue(entity.getCurrentValue()); definition.setManufacture(entity.getManufacture()); definition.setModel(entity.getModel()); definition.setModemId(entity.getModemId()); definition.setPinNumber(entity.getPinNumber()); definition.setPricePerSms(entity.getPricePerSms()); definition.setSmscNumber(entity.getSmscNumber()); definition.setUpdatedBy("System"); definition.setUpdatedOn(new Date()); definition.setCheckPulsa(entity.getCheckPulsa()); definition.setPhoneNumber(entity.getPhoneNumber()); this.modemDefinitionDao.update(definition); }
From source file:net.longfalcon.newsj.Nfo.java
/** * only returns one NFO. dunno about releases with two nfos. * @param release//from w w w. j a v a2 s . c o m * @return */ @Transactional(readOnly = true, propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED) public ReleaseNfo determineReleaseNfo(Release release) { Pattern nfoPattern = Pattern.compile(".*\\.nfo[ \"\\)\\]\\-]?.*", Pattern.CASE_INSENSITIVE); List<Binary> binaryList = binaryDAO.findBinariesByReleaseId(release.getId()); for (Binary binary : binaryList) { Matcher matcher = nfoPattern.matcher(binary.getName()); if (matcher.matches()) { ReleaseNfo releaseNfo = new ReleaseNfo(); releaseNfo.setBinary(binary); releaseNfo.setRelease(release); return releaseNfo; } } return null; }
From source file:com.inkubator.sms.gateway.service.impl.TaskDefinitionServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void update(TaskDefinition entity) throws Exception { TaskDefinition taskDefinition = taskDefinitionDao.getEntiyByPK(entity.getId()); taskDefinition.setDate(entity.getDate()); taskDefinition.setDestination(entity.getDestination()); taskDefinition.setFromSending(entity.getFromSending()); taskDefinition.setModemDefinition(modemDefinitionDao.getEntiyByPK(entity.getModemDefinition().getId())); taskDefinition.setIsRepeatOnCondition(entity.getIsRepeatOnCondition()); taskDefinition.setName(entity.getName()); taskDefinition.setRepeatTime(entity.getRepeatTime()); taskDefinition.setScheduleType(entity.getScheduleType()); taskDefinition.setSendingCount(entity.getSendingCount()); taskDefinition.setSmsContent(entity.getSmsContent()); taskDefinition.setTime(entity.getTime()); taskDefinition.setUpdatedBy(UserInfoUtil.getUserName()); taskDefinition.setUpdatedOn(new Date()); this.taskDefinitionDao.update(taskDefinition); }
From source file:com.inkubator.hrm.service.impl.LoanTypeServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void save(LoanType t) throws Exception { long totalLoanCodeDuplicates = loanTypeDao.getTotalByLoanTypeCode(t.getLoanTypeCode()); if (totalLoanCodeDuplicates > 0) { throw new BussinessException("loantype.error_duplicate_loan_type_code"); }//from w w w . j a va 2 s . c o m long totalLoanNameDuplicates = loanTypeDao.getTotalByLoanTypeName(t.getLoanTypeName()); if (totalLoanNameDuplicates > 0) { throw new BussinessException("loantype.error_duplicate_loan_type_name"); } t.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); t.setCreatedBy(UserInfoUtil.getUserName()); t.setCreatedOn(new Date()); loanTypeDao.save(t); }