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

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

Introduction

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

Prototype

Propagation NOT_SUPPORTED

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

Click Source Link

Document

Execute non-transactionally, suspend the current transaction if one exists.

Usage

From source file:example.springdata.jpa.java8.Java8IntegrationTests.java

/**
 * Here we demonstrate the usage of {@link CompletableFuture} as a result wrapper for asynchronous repository query
 * methods. Note, that we need to disable the surrounding transaction to be able to asynchronously read the written
 * data from from another thread within the same test method.
 *//*from ww  w  . jav a  2s  .com*/
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void supportsCompletableFuturesAsReturnTypeWrapper() throws Exception {

    repository.save(new Customer("Customer1", "Foo"));
    repository.save(new Customer("Customer2", "Bar"));

    CompletableFuture<Void> future = repository.readAllBy().thenAccept(customers -> {

        assertThat(customers, hasSize(2));
        customers.forEach(customer -> log.info(customer.toString()));
        log.info("Completed!");
    });

    while (!future.isDone()) {
        log.info("Waiting for the CompletableFuture to finish...");
        TimeUnit.MILLISECONDS.sleep(500);
    }

    future.get();

    log.info("Done!");
}

From source file:com.xyz.framework.data.impl.JpaDao.java

/**
 * ,??.//www . j av a 2 s  . co  m
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public Page<T> findBy(final Page page, final String propertyName, final Object value) {
    Assert.hasText(propertyName, "propertyName?");
    Assert.notNull(value, "value?");
    final String filter = buildPropertyFilterCriterion(propertyName, value, MatchType.EQ);
    String sql = getBaseSql() + " where " + filter;
    sql = dealOrder(sql, page);
    Query query = entityManager.createQuery(sql);
    if (page.isAutoCount()) {
        int totalCount = countJpaQlResult(filter);
        page.setTotalCount(totalCount);
    }
    query.setFirstResult(page.getStart());
    query.setMaxResults(page.getLimit());
    List<T> lt = query.getResultList();
    page.setResult(lt);
    return page;
}

From source file:com.mycomm.dao.mydao.base.MyDaoSupport.java

@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public ResultHelp<T> getScrollData(int firstindex, int maxresult, LinkedHashMap<String, String> orderby) {
    return getScrollData(firstindex, maxresult, null, null, orderby);
}

From source file:org.hsweb.web.datasource.dynamic.DynamicDataSourceSqlExecutorService.java

@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void exec(SQL sql) throws SQLException {
    super.exec(sql);
}

From source file:com.gcrm.service.impl.BaseService.java

@SuppressWarnings("rawtypes")
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public List findVOByHQL(String hql) {
    return baseDao.findVOByHQL(hql);
}

From source file:com.gettec.fsnip.fsn.service.product.impl.ProductInstanceServiceImpl.java

/**
 * ??IDID?????/*from  ww w.j a  v a  2 s .  com*/
 * @param productId
 * @param storageId
 * @param organization
 * @return ??
 * Author ?
 * 2014-10-27
 * 
 */
@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public List<ProductInstance> getProductInstancesByStorageInfoAndStorage(Long productId, String storageId,
        Long organization) {
    return getDAO().getProductInstancesByStorageInfoAndStorage(productId, storageId, organization);
}

From source file:com.mycomm.dao.mydao.base.MyDaoSupport.java

@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public ResultHelp<T> getScrollData(int firstindex, int maxresult) {
    return getScrollData(firstindex, maxresult, null, null, null);
}

From source file:com.google.ie.business.dao.impl.ProjectDaoImpl.java

@SuppressWarnings("unchecked")
@Override//from www  .  j ava  2  s .  c o  m
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public List<Project> getProjectsByKeys(Set<String> projectKeys, RetrievalInfo retrievalInfo) {
    Query query = null;
    try {
        query = getJdoTemplate().getPersistenceManagerFactory().getPersistenceManager().newQuery(Project.class);
        query.setFilter("key == :projectKeys");
        query.setRange(retrievalInfo.getStartIndex(),
                retrievalInfo.getNoOfRecords() + retrievalInfo.getStartIndex());
        Map<String, Object> mapOfFilterValues = new HashMap<String, Object>();
        mapOfFilterValues.put("projectKeys", projectKeys);

        Collection<Project> projects = getJdoTemplate().find(query.toString(), mapOfFilterValues);
        /* Detach the result from the corresponding persistence manager */
        projects = getJdoTemplate().detachCopyAll(projects);
        return new ArrayList<Project>(projects);
    } finally {
        if (query != null) {
            query.closeAll();
        }
    }

}

From source file:com.mycomm.dao.mydao.base.MyDaoSupport.java

@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public ResultHelp<T> getScrollData() {
    return getScrollData(-1, -1);
}

From source file:org.wallride.service.PostService.java

@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void updatePostViews() {
    LocalDateTime now = LocalDateTime.now();
    Set<JobExecution> jobExecutions = jobExplorer.findRunningJobExecutions("updatePostViewsJob");
    for (JobExecution jobExecution : jobExecutions) {
        LocalDateTime startTime = LocalDateTime.ofInstant(jobExecution.getStartTime().toInstant(),
                ZoneId.systemDefault());
        Duration d = Duration.between(now, startTime);
        if (Math.abs(d.toMinutes()) == 0) {
            logger.info("Skip processing because the job is running.");
            return;
        }//from   w  w  w  .ja v  a2  s.  c om
    }

    JobParameters params = new JobParametersBuilder()
            .addDate("now", Date.from(now.atZone(ZoneId.systemDefault()).toInstant())).toJobParameters();
    try {
        jobLauncher.run(updatePostViewsJob, params);
    } catch (Exception e) {
        throw new ServiceException(e);
    }
}