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:es.upm.fiware.rss.expenditureLimit.manager.test.ExpenditureLimitManagerTest.java

/**
 * // ww w .j  ava 2  s  . c  o m
 */
//@Test
@Transactional(propagation = Propagation.SUPPORTS)
public void storeGeneralUserExpLimits() throws RSSException {
    ExpenditureLimitManagerTest.logger.debug("Into storeGeneralUserExpLimits method");
    thrown.expect(RSSException.class);
    thrown.expectMessage("LimitGroupBean");
    LimitGroupBean expLimits = ExpenditureLimitBeanConstructor.generateLimitGroupBean();
    UserExpenditureLimitInfoBean limits = elManager.storeGeneralUserExpLimit(aggregator, appProvider, userId,
            expLimits);
    Assert.assertNotNull(limits);
    Assert.assertEquals(expLimits.getService(), limits.getService());
    Assert.assertEquals(expLimits.getLimits().get(0).getCurrency(),
            limits.getGeneralUserLimits().get(0).getCurrency());
    ExpenditureLimitManagerTest.logger.debug("ObtainException Exception for test");
    elManager.storeGeneralUserExpLimit(aggregator, appProvider, userId, null);
}

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

/**
 * {@inheritDoc}//www.  jav  a2  s.co m
 */
@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public Collection<T> findByQuery(String qlString, Map<String, ? extends Object> args) {
    Query query = entityManager.createQuery(qlString);
    for (Map.Entry<String, ? extends Object> parameter : args.entrySet()) {
        query.setParameter(parameter.getKey(), parameter.getValue());
    }
    return query.getResultList();
}

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

/**
 * /*ww  w.  j  a v  a  2s . c om*/
 */
@Transactional(propagation = Propagation.SUPPORTS)
public void checkExpLimitDataTest() throws RSSException {
    ExpenditureLimitDataCheckerTest.logger.debug("Into checkExpLimitDataTest mehtod");
    thrown.expect(RSSException.class);
    thrown.expectMessage("Missing mandatory parameter: Limit Currency");
    LimitBean limitBean = ExpenditureLimitBeanConstructor.createExpCtrlBean();
    checker.checkExpLimitData(limitBean);
    ExpenditureLimitDataCheckerTest.logger.debug("No exception expected");
    limitBean.setCurrency(null);
    checker.checkExpLimitData(limitBean);
}

From source file:es.upm.fiware.rss.dao.impl.test.DbeTransactionDaoImplTest.java

@Transactional(propagation = Propagation.SUPPORTS)
public void testDeleteTransactionsByProviderId() {
    int txTransactionId = 1;
    String providerId = new String("provider");
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(Propagation.REQUIRES_NEW.value());
    TransactionStatus status = transactionManager.getTransaction(def);
    dbeTransactionDAO.deleteTransactionsByProviderId(providerId);
    transactionManager.commit(status);// w w  w  .  j ava 2s .  com
    List<DbeTransaction> listDbeTr = dbeTransactionDAO.getTransactionsByProviderId(providerId);

    if (listDbeTr != null && listDbeTr.size() > 0) {
        DbeTransactionDaoImplTest.LOGGER.debug("looking result list data....");
        DbeTransactionDaoImplTest.LOGGER.error("Obtained:" + listDbeTr.get(0).getTxTransactionId());
        Assert.assertTrue("0 data obtained ", listDbeTr.get(0).getTxTransactionId() == txTransactionId);
    } else {
        DbeTransactionDaoImplTest.LOGGER.debug("Obtained 0 data is not possible with datatest values");
        Assert.assertTrue("0 data obtained ", true);
    }

}

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

@Override
@Transactional(readOnly = true, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 30)
public Long getTotalData() throws Exception {
    return payTempOvertimeDao.getTotalData();
}

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

@Transactional(propagation = Propagation.SUPPORTS)
@Override/*w w  w.jav  a  2 s .  c om*/
public boolean isExistingEnrollment(Customer customer, Section section) {

    List<Enrollment> enrollments;

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

    query.setParameter("customer", customer);
    query.setParameter("section", section);

    enrollments = query.list();

    if (enrollments.isEmpty()) {

        return false;
    } else {

        return true;
    }
}

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

@Transactional(propagation = Propagation.SUPPORTS)
public List<Utente> findAll() throws DAOException {
    return findByCriteria(Restrictions.ne("userName", "test"));
}

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

/** {@inheritDoc} */
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public User getUser(Long userId) {
    return userDao.get(userId);
}

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

/** {@inheritDoc} */
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public List<User> getUsers(Integer pageSize, Integer pageNumber, Map<String, String> sortOrders,
        Map<String, String> userFilters) {
    return userDao.getUsers(pageSize, pageNumber, sortOrders, userFilters);
}

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

/**
 * {@inheritDoc}//from w  ww  . j  av a  2s  .c  o  m
 */
@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public List<T> findByQuery(String qlString, Object[] args) {
    Query query = entityManager.createQuery(qlString);
    if (args != null) {
        for (int i = 0; i < args.length; i++) {
            query.setParameter(i + 1, args[i]);
        }
    }
    return query.getResultList();
}