List of usage examples for org.springframework.transaction.annotation Isolation REPEATABLE_READ
Isolation REPEATABLE_READ
To view the source code for org.springframework.transaction.annotation Isolation REPEATABLE_READ.
Click Source Link
From source file:com.inkubator.hrm.service.impl.TempAttendanceRealizationServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50) public List<TempAttendanceRealizationMonthEndViewModel> getAllDataMonthEndByPeriodId(Long wtPeriodId) throws Exception { return tempAttendanceRealizationDao.getAllDataMonthEndByPeriodId(wtPeriodId); }
From source file:com.inkubator.hrm.service.impl.TempAttendanceRealizationServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50) public List<TempAttendanceRealization> getPaidOvertimeByParam(PaidOvertimeSearchParameter searchParameter, int firstResult, int maxResults, Order orderable) throws Exception { return tempAttendanceRealizationDao.getPaidOvertimeByParam(searchParameter, firstResult, maxResults, orderable);// w w w . j a v a2 s . c o m }
From source file:com.inkubator.hrm.service.impl.TempAttendanceRealizationServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 30) public Long getTotalPaidOvertimeByParam(PaidOvertimeSearchParameter searchParameter) throws Exception { return tempAttendanceRealizationDao.getTotalPaidOvertimeByParam(searchParameter); }
From source file:fsl.ta.toms.roms.service.impl.RoadCompliancyServiceImpl.java
@Transactional(propagation = Propagation.NEVER, isolation = Isolation.REPEATABLE_READ, readOnly = true) public List<ComplianceBO> lookupRoadComplianceActivities(RoadCompliancyCriteriaBO roadCompliancyCriteriaBO) { logger.info("In lookupRoadComplianceActivities web service function."); List<ComplianceBO> result = new ArrayList<ComplianceBO>(); result = daoFactory.getRoadCompliancyDAO().lookupRoadComplianceActivities(roadCompliancyCriteriaBO); List<OffenceBO> listOfOffences = new ArrayList<OffenceBO>(); List<RoadCheckBO> listOfRoadChecks = new ArrayList<RoadCheckBO>(); for (ComplianceBO complianceBO : result) { listOfOffences = daoFactory.getRoadCompliancyDAO() .getOffencesforCompliance(complianceBO.getComplianceId()); listOfRoadChecks = daoFactory.getRoadCompliancyDAO() .getRoadChecksforCompliance(complianceBO.getComplianceId()); complianceBO.setListOfOffences(listOfOffences); complianceBO.setListOfRoadChecks(listOfRoadChecks); listOfOffences = null;//from w ww . j av a 2s. com listOfRoadChecks = null; } return result; }
From source file:org.hyperic.hq.monitor.MockServiceImpl.java
@Transactional(isolation = Isolation.REPEATABLE_READ) public void foo(long duration, Pojo obj) { try {/* w ww . jav a 2s.co m*/ Thread.sleep(duration); } catch (InterruptedException e) { logger.warn("Thread interrupted, shutting down."); } catch (Exception e) { logger.warn(e); } logger.debug("completed " + this.getClass().getName() + ".foo()"); }
From source file:org.projectforge.address.PersonalAddressDao.java
/** * @param obj/* ww w .ja v a2s. c o m*/ * @return the generated identifier. */ @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.REPEATABLE_READ) public Serializable saveOrUpdate(final PersonalAddressDO obj) { if (internalUpdate(obj) == true) { return obj.getId(); } return internalSave(obj); }
From source file:org.projectforge.business.fibu.datev.DatevImportDao.java
@SuppressWarnings("unchecked") @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.REPEATABLE_READ) public void commit(final ImportStorage<?> storage, final String sheetName) { checkLoggeinUserRight(accessChecker); Validate.notNull(storage.getSheets()); final ImportedSheet<?> sheet = storage.getNamedSheet(sheetName); Validate.notNull(sheet);//w w w . ja va 2s.co m if (sheet.getStatus() != ImportStatus.RECONCILED) { throw new UserException("common.import.action.commit.error.notReconciled"); } int no = -1; if (storage.getId() == Type.KONTENPLAN) { no = commitKontenplan((ImportedSheet<KontoDO>) sheet); } else { no = commitBuchungsdaten((ImportedSheet<BuchungssatzDO>) sheet); } sheet.setNumberOfCommittedElements(no); sheet.setStatus(ImportStatus.IMPORTED); }
From source file:org.projectforge.business.meb.MebDao.java
/** * Try to assign the owner from the sender number first. Ignore if the entry does already exist in the data base. * //from www . j a v a2 s .com * @param entry * @return Number of new imported messages. */ @SuppressWarnings("unchecked") @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.REPEATABLE_READ) public boolean checkAndAddEntry(final MebEntryDO entry, final String source) { Validate.notNull(entry.getSender()); Validate.notNull(entry.getDate()); Validate.notNull(entry.getMessage()); entry.setStatus(MebEntryStatus.RECENT); synchronized (this) { final String checkSum = createCheckSum(entry.getMessage()); // First check weather the entry is already in the data base or not. final List<ImportedMebEntryDO> entryList = (List<ImportedMebEntryDO>) getHibernateTemplate().find( "from ImportedMebEntryDO e where e.sender = ? and e.date = ? and e.checkSum = ?", new Object[] { entry.getSender(), entry.getDate(), checkSum }); if (entryList != null && entryList.size() > 0) { return false; } // Try to assign the owner from the sender string. final List<Object[]> userList = getSession().createQuery( "select id, personalMebMobileNumbers from PFUserDO u where deleted = false and personalMebMobileNumbers is not null") .list(); final String senderNumber = StringHelper.removeNonDigits(entry.getSender()); Integer pk = null; for (final Object[] user : userList) { final String personalPhoneIdentifiers = StringHelper.removeNonDigits((String) user[1]); if (personalPhoneIdentifiers.length() == 0) { continue; } if (personalPhoneIdentifiers.contains(senderNumber) == true) { if (pk != null) { log.warn("Sender string '" + entry.getSender() + "' found twice (user pk's): " + pk + ", " + user[0]); } else { pk = (Integer) user[0]; } } } if (pk != null) { final PFUserDO user = (PFUserDO) getSession().load(PFUserDO.class, pk); entry.setOwner(user); } internalSave(entry); final ImportedMebEntryDO imported = new ImportedMebEntryDO(); imported.setCheckSum(checkSum); imported.setDate(entry.getDate()); imported.setSender(entry.getSender()); imported.setCreated(); imported.setLastUpdate(); imported.setSource(source); getHibernateTemplate().save(imported); return true; } }
From source file:org.projectforge.business.multitenancy.TenantDao.java
/** * Assigns tenants to and unassigns tenants from given user. * /* www. ja v a 2 s . c o m*/ * @param user * @param tenantsToAssign Tenants to assign (nullable). * @param tenantsToUnassign Tenants to unassign (nullable). * @throws AccessException */ @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.REPEATABLE_READ) public void assignTenants(final PFUserDO user, final Set<TenantDO> tenantsToAssign, final Set<TenantDO> tenantsToUnassign) { internalAssignTenants(user, tenantsToAssign, tenantsToUnassign, true, true); }
From source file:org.projectforge.business.multitenancy.TenantDao.java
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.REPEATABLE_READ) public void internalAssignTenants(final PFUserDO user, final Set<TenantDO> tenantsToAssign, final Set<TenantDO> tenantsToUnassign, boolean checkAccess, boolean createHistoryEntry) throws AccessException { getHibernateTemplate().refresh(user, LockMode.READ); if (checkAccess) { if (TenantChecker.isSuperAdmin(ThreadLocalUserContext.getUser()) == false) { log.warn("User has now access right to change assigned users of a tenant! Skipping assignment."); return; }/* ww w . j a v a 2 s. c om*/ } final List<TenantDO> assignedTenants = new ArrayList<TenantDO>(); if (tenantsToAssign != null) { for (final TenantDO tenant : tenantsToAssign) { final TenantDO dbTenant = getHibernateTemplate().get(clazz, tenant.getId(), LockMode.PESSIMISTIC_WRITE); Set<PFUserDO> assignedUsers = dbTenant.getAssignedUsers(); if (assignedUsers == null) { assignedUsers = new HashSet<PFUserDO>(); dbTenant.setAssignedUsers(assignedUsers); } if (assignedUsers.contains(user) == false) { log.info("Assigning user '" + user.getUsername() + "' to tenant '" + dbTenant.getName() + "'."); assignedUsers.add(user); assignedTenants.add(dbTenant); dbTenant.setLastUpdate(); // Needed, otherwise TenantDO is not detected for hibernate history! } else { log.info("User '" + user.getUsername() + "' already assigned to tenant '" + dbTenant.getName() + "'."); } } } final List<TenantDO> unassignedTenants = new ArrayList<TenantDO>(); if (tenantsToUnassign != null) { for (final TenantDO tenant : tenantsToUnassign) { final TenantDO dbTenant = getHibernateTemplate().get(clazz, tenant.getId(), LockMode.PESSIMISTIC_WRITE); final Set<PFUserDO> assignedUsers = dbTenant.getAssignedUsers(); if (assignedUsers != null && assignedUsers.contains(user) == true) { log.info("Unassigning user '" + user.getUsername() + "' from tenant '" + dbTenant.getName() + "'."); assignedUsers.remove(user); unassignedTenants.add(dbTenant); dbTenant.setLastUpdate(); // Needed, otherwise TenantDO is not detected for hibernate history! } else { log.info("User '" + user.getUsername() + "' is not assigned to tenant '" + dbTenant.getName() + "' (can't unassign)."); } } } flushSession(); if (createHistoryEntry) { createHistoryEntry(user, unassignedTenants, assignedTenants); } }