List of usage examples for org.springframework.transaction.annotation Propagation SUPPORTS
Propagation SUPPORTS
To view the source code for org.springframework.transaction.annotation Propagation SUPPORTS.
Click Source Link
From source file:org.cleverbus.core.common.dao.ExternalCallDaoJpaImpl.java
@Override @Nullable/*from w w w . j a va 2s. c om*/ @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public ExternalCall getExternalCall(String operationName, String entityId) { Assert.notNull(operationName, "operationName (uri) must not be null"); Assert.notNull(entityId, "entityId (operation key) must not be null"); String jSql = "SELECT c FROM " + ExternalCall.class.getName() + " c " + "WHERE c.operationName = ?1 AND c.entityId = ?2"; TypedQuery<ExternalCall> q = em.createQuery(jSql, ExternalCall.class); q.setParameter(1, operationName); q.setParameter(2, entityId); List<ExternalCall> results = q.getResultList(); if (results.isEmpty()) { return null; } if (results.size() > 1) { throw new MultipleDataFoundException( String.format("Multiple ExternalCall instances found for operationName/entityId: %s/%s", operationName, entityId)); } return results.get(0); }
From source file:com.brienwheeler.svc.users.impl.UserRoleService.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) @MonitoredWork//from w w w. j a va 2 s .c o m @GracefulShutdown public List<String> getUserRoles(User user) { DbValidationUtils.assertPersisted(user); return userRoleDao.findByUserAsStrings(user); }
From source file:org.brekka.phalanx.core.services.impl.PasswordBasedCryptoServiceImpl.java
@Override @Transactional(propagation = Propagation.SUPPORTS, noRollbackFor = { PhalanxException.class }) public <T> T decrypt(PasswordedCryptoData cryptoData, String password, Class<T> expectedType) { cryptoData = (PasswordedCryptoData) cryptoDataDAO.retrieveById(cryptoData.getId()); byte[] cipherText = cryptoData.getData(); byte[] salt = cryptoData.getSalt(); Integer iterations = cryptoData.getIterations(); byte[] key = toKey(password); CryptoProfile cryptoProfile = cryptoProfileService.retrieveProfile(cryptoData.getProfile()); DerivedKey derivedKey = phoenixDerived.apply(key, salt, iterations, cryptoProfile); SymmetricCryptoSpec symmetricCryptoSpec = phoenixSymmetric.toSymmetricCryptoSpec(derivedKey); byte[] result; try {//from w ww . jav a 2 s . c o m result = phoenixSymmetric.decrypt(cipherText, symmetricCryptoSpec); } catch (PhoenixException e) { if (e.getCause() instanceof BadPaddingException) { throw new PhalanxException(PhalanxErrorCode.CP302, "The password is incorrect"); } throw e; } int digestLength = phoenixDigest.getDigestLength(cryptoProfile); byte[] digest = ArrayUtils.subarray(result, 0, digestLength); byte[] data = ArrayUtils.subarray(result, digestLength, result.length); DigestResult digestResult = phoenixDigest.digest(data, cryptoProfile); if (!Arrays.equals(digest, digestResult.getDigest())) { throw new PhalanxException(PhalanxErrorCode.CP302, "The password is incorrect"); } return toType(data, expectedType, cryptoData.getId(), cryptoProfile); }
From source file:com.brienwheeler.lib.db.dao.NonDeletableDaoBase.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public EntityType findById(long id) { return entityManager.find(getEntityClass(), id); }
From source file:com.inkubator.hrm.service.impl.PayTempOvertimeServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50) public List<PayTempOvertime> getByParam(PayTempOvertimeSearchParameter searchParameter, int firstResult, int maxResults, Order order) throws Exception { return payTempOvertimeDao.getByParam(searchParameter, firstResult, maxResults, order); }
From source file:com.brienwheeler.svc.users.impl.UserEmailAddressDao.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) @SuppressWarnings("unchecked") public List<UserEmailAddress> findByUser(User user) { Query query = entityManager/* w w w.ja va 2s.c om*/ .createQuery("from UserEmailAddress where user = :user order by emailAddress.address"); query.setParameter("user", user); return (List<UserEmailAddress>) query.getResultList(); }
From source file:com.brienwheeler.lib.db.dao.PersistentAttributeDaoBase.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public AttrClass findByOwnerAndName(long ownerId, String name) { Query query = entityManager.createQuery( "from " + getEntityClass().getSimpleName() + " where owner_id = :ownerId and name = :name"); query.setParameter("ownerId", ownerId); query.setParameter("name", name); return getSingleResultOrNull(query); }
From source file:org.horizontaldb.example.model.dao.PersonDaoImpl.java
@Override @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public Person getPersonById(Long id) { return (Person) getSession().get(Person.class, id); }
From source file:com.inkubator.hrm.service.impl.SystemLetterReferenceServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public SystemLetterReference getEntiyByPK(Long id) throws Exception { return systemLetterReferenceDao.getEntiyByPK(id); }
From source file:com.inkubator.hrm.service.impl.BioRelasiPerusahaanServiceImpl.java
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 30) public Long getTotalByParam(BioRelasiPerusahaanSearchParameter searchParameter) throws Exception { return bioRelasiPerusahaanDao.getTotalByParam(searchParameter); }