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.tid.fiware.rss.dao.impl.test.DbeSystemPropertiesDaoImplTest.java

@Test
@Transactional(propagation = Propagation.SUPPORTS)
public void testeUpdate() {
    DbeSystemProperties c = dbeSystemPropertiesDao.getById("name");
    c.setTxParamDescription("new description");
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(Propagation.REQUIRES_NEW.value());
    TransactionStatus status = transactionManager.getTransaction(def);
    dbeSystemPropertiesDao.update(c);//from ww w .  jav a  2  s.c o m
    transactionManager.commit(status);
    c = dbeSystemPropertiesDao.getById("name");
    Assert.assertTrue(
            dbeSystemPropertiesDao.getById("name").getTxParamDescription().equalsIgnoreCase("new description"));
}

From source file:gr.abiss.calipso.jpasearch.service.impl.AbstractAclAwareServiceImpl.java

/**
 * {@inheritDoc}/*from w w  w  .jav  a2s .  c  om*/
 */
@Override
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public Class<T> getDomainClass() {
    return this.repository.getDomainClass();
}

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

/**
 * /*from   w w  w  . j  a v  a2  s  .com*/
 */
@Transactional(propagation = Propagation.SUPPORTS)
public void checkRequiredSearchParametersTest() throws RSSException {
    ExpenditureLimitDataCheckerTest.logger.debug("Into checkRequiredSearchParametersTest mehtod");
    thrown.expect(RSSException.class);
    thrown.expectMessage("Required parameters not found:enUserId, service, appProvider.");
    checker.checkRequiredSearchParameters("urlEndUserId", "service", "aggId", "appPorviderId");
    ExpenditureLimitDataCheckerTest.logger.debug("No exception expected");
    checker.checkRequiredSearchParameters(null, "service", "aggId", "appPorvider");

}

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

@Transactional(propagation = Propagation.SUPPORTS)
public void testeUpdate() {
    DbeSystemProperties c = dbeSystemPropertiesDao.getById("name");
    c.setTxParamDescription("new description");
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(Propagation.REQUIRES_NEW.value());
    TransactionStatus status = transactionManager.getTransaction(def);
    dbeSystemPropertiesDao.update(c);//from www. j a va2 s .  c  o m
    transactionManager.commit(status);
    c = dbeSystemPropertiesDao.getById("name");
    Assert.assertTrue(
            dbeSystemPropertiesDao.getById("name").getTxParamDescription().equalsIgnoreCase("new description"));
}

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

/** {@inheritDoc} */
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Long getJobsCount() {
    return jobDao.getJobsCount();
}

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

/**
 * //from w w  w.  java  2  s  .  co m
 */
@Transactional(propagation = Propagation.SUPPORTS)
public void storeGeneralProviderExpLimits() throws RSSException {
    ExpenditureLimitManagerTest.logger.debug("Into storeGeneralProviderExpLimits method");
    thrown.expect(RSSException.class);
    thrown.expectMessage("LimitGroupBean");
    LimitGroupBean expLimits = ExpenditureLimitBeanConstructor.generateLimitGroupBean();
    LimitGroupBean limits = elManager.storeGeneralProviderExpLimit(aggregator, appProvider, expLimits);
    Assert.assertNotNull(limits);
    Assert.assertEquals(expLimits.getService(), limits.getService());
    Assert.assertEquals(expLimits.getLimits().size(), limits.getLimits().size());
    Assert.assertEquals(expLimits.getLimits().get(0).getCurrency(), limits.getLimits().get(0).getCurrency());
    ExpenditureLimitManagerTest.logger.debug("ObtainException Exception for test");
    limits = elManager.storeGeneralProviderExpLimit(aggregator, appProvider, null);
}

From source file:org.apigw.authserver.svc.impl.CertifiedClientDetailsServiceImpl.java

@Override
@Transactional(propagation = Propagation.SUPPORTS)
public CertifiedClient findClientByClientId(String clientId) {
    return certifiedClientRepository.findClientByClientIdEager(clientId);
}

From source file:com.auditbucket.registration.service.FortressService.java

@Cacheable(value = "fortressUser", unless = "#result==null")
@Transactional(propagation = Propagation.SUPPORTS)
public FortressUser getFortressUser(Fortress fortress, String fortressUser, boolean createIfMissing) {
    if (fortressUser == null || fortress == null)
        throw new IllegalArgumentException("Don't go throwing null in here ["
                + (fortressUser == null ? "FortressUserNode]" : "FortressNode]"));

    FortressUser fu = fortressDao.getFortressUser(fortress.getId(), fortressUser.toLowerCase());
    if (createIfMissing && fu == null)
        fu = addFortressUser(fortress.getId(), fortressUser.toLowerCase().trim());
    return fu;//  w w  w .j a v a  2s. co  m
}

From source file:es.upm.fiware.rss.expenditureLimit.server.test.ExpenditureLimitServerTest.java

/**
 * /*from w  w w. j a  v  a 2 s  .com*/
 * @throws Exception
 */
@Transactional(propagation = Propagation.SUPPORTS)
public void getProviderExpLimits() throws Exception {
    Response response = server.getProviderExpLimits(aggregator, appProvider, service, currency, type);
    Assert.assertEquals(200, response.getStatus());
}

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

/**
 * Load all the users//from ww w.j a v  a 2s  .co  m
 */
@Transactional(propagation = Propagation.SUPPORTS)
public List<Utente> loadAll() {
    // Create query
    //
    // Query query = _entityManager.createQuery("from Utente utente");

    // Execute query
    //
    return null;// (List<Utente>) query.getResultList();
}