Example usage for org.springframework.transaction.annotation Propagation SUPPORTS

List of usage examples for org.springframework.transaction.annotation Propagation SUPPORTS

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Propagation SUPPORTS.

Prototype

Propagation SUPPORTS

To view the source code for org.springframework.transaction.annotation Propagation SUPPORTS.

Click Source Link

Document

Support a current transaction, execute non-transactionally if none exists.

Usage

From source file:it.geosdi.era.server.dao.hibernate.DAOUtenteHibernate.java

@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.SUPPORTS)
public List<Utente> getUsers(long id) {
    List<Utente> listaUtenti = new ArrayList<Utente>();
    Session session = getSession();/*from  w  w w . jav a 2 s.co  m*/
    Query query = session.createQuery(
            "select distinct utente from Utente utente left join fetch utente.utentiProgetto where utente.id != ? and utente.userName != 'test'");
    query.setLong(0, id);
    listaUtenti = query.list();
    return listaUtenti;

}

From source file:es.upm.fiware.rss.expenditureLimit.manager.test.ExpenditureLimitDataCheckerTest.java

/**
 * //ww w  .j av a2  s.  c o m
 */
@Transactional(propagation = Propagation.SUPPORTS)
public void checkMandatoryDatumExistenceTest() throws RSSException {
    ExpenditureLimitDataCheckerTest.logger.debug("Into checkMandatoryDatumExistenceTest mehtod");
    thrown.expect(RSSException.class);
    thrown.expectMessage("datumName");
    checker.checkMandatoryDatumExistence("datum", "datumName");
    ExpenditureLimitDataCheckerTest.logger.debug("No exception expected");
    checker.checkMandatoryDatumExistence(null, "datumName");
}

From source file:com.oak_yoga_studio.dao.impl.EnrollmentDAOImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
@Override/*  w ww.  ja  v a2s  . c o  m*/
public boolean isFirstTimeEnrollment(Customer customer) {

    List<Enrollment> enrollments;

    Query query = sf.getCurrentSession()
            .createQuery("select distinct e from Enrollment e where e.customer=:customer"
                    + " and ( e.status ='COMPLETED' OR e.status ='ACTIVE')  ");

    query.setParameter("customer", customer);
    enrollments = query.list();

    if (enrollments.isEmpty()) {

        return true;
    } else {

        return false;
    }
}

From source file:org.jrecruiter.service.impl.UserServiceImpl.java

/** {@inheritDoc} */
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public UserDetails loadUserByUsername(final String emailOrUserName)
        throws UsernameNotFoundException, DataAccessException {

    final User user = userDao.getUserByUsernameOrEmail(emailOrUserName.trim());

    if (user == null) {
        LOGGER.warn("loadUserByUsername() - No user with id " + emailOrUserName + " found.");
        throw new UsernameNotFoundException(
                "loadUserByUsername() - No user with id " + emailOrUserName + " found.");
    }//w w  w. j av a  2 s  . c  o m

    LOGGER.info("User {} ({}) loaded.", new Object[] { user.getUsername(), user.getEmail() });

    return user;
}

From source file:com.inkubator.hrm.service.impl.SystemLetterReferenceServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED, propagation = Propagation.SUPPORTS, timeout = 50)
public List<SystemLetterReference> getAllData() throws Exception {
    return systemLetterReferenceDao.getAllData();
}

From source file:com.healthcit.cacure.dao.FormDao.java

/**
 * @return Next Ord Number in ordered entities.
 */// w ww  .  ja v a 2 s .  c o  m
@Transactional(propagation = Propagation.SUPPORTS)
public Integer calculateNextOrdNumber(Long moduleId) {
    String jpql = "select MAX(ord + 1) from BaseForm f where f.module.id = :moduleId";
    Query query = em.createQuery(jpql);
    query.setParameter("moduleId", moduleId);
    return (Integer) query.getSingleResult();
}

From source file:se.vgregion.dao.domain.patterns.repository.db.jpa.AbstractJpaRepository.java

/**
 * {@inheritDoc}//w  w w. java  2  s.c  o  m
 */
@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public Collection<T> findByQuery(String qlString) {
    Query query = entityManager.createQuery(qlString);
    return query.getResultList();
}

From source file:org.brekka.phalanx.core.services.impl.AsymmetricCryptoServiceImpl.java

@Override
@Transactional(propagation = Propagation.SUPPORTS)
public PrivateKeyToken decrypt(AsymmetricKeyPair keyPair, final PrivateKeyToken privateKeyToken) {
    // Resolve the key pair from persistent storage (could just be id)
    keyPair = this.asymetricKeyPairDAO.retrieveById(keyPair.getId());

    CryptoData privateKey = keyPair.getPrivateKey();
    if (privateKey instanceof AsymedCryptoData == false) {
        throw new PhalanxException(PhalanxErrorCode.CP210,
                "Key pair '%s' private key is not protected by another private key", keyPair.getId());
    }//from   ww w.j  a v  a 2s . c om
    AsymedCryptoData asymedCryptoData = (AsymedCryptoData) privateKey;
    InternalSecretKeyToken secretKeyToken = decrypt(asymedCryptoData, privateKeyToken,
            InternalSecretKeyToken.class);
    return symDecryptForPrivateKey(secretKeyToken, keyPair);
}

From source file:it.geosdi.era.server.dao.hibernate.DAOUtenteHibernate.java

@Transactional(propagation = Propagation.SUPPORTS)
public void inizializzaProgetti(Utente utente) throws DAOException {
    try {//from w  w  w  . j av  a 2s .  c o m
        // Hibernate.initialize(utente.getUtentiProgetto());
        getSession().get(Utente.class, utente.getId());
    } catch (HibernateException e) {
        throw new DAOException(e);
    }
}

From source file:com.inkubator.sms.gateway.service.impl.SmsActivityServiceImpl.java

@Override
@Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50)
public List<SmsActivity> getAllData() throws Exception {
    return this.smsActivityDao.getAllData();
}