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

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

Introduction

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

Prototype

Propagation REQUIRES_NEW

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

Click Source Link

Document

Create a new transaction, and suspend the current transaction if one exists.

Usage

From source file:cs544.blog.service.BlogService.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public List<Post> getAllPost() {
    return userDAO.getAllPosts();
}

From source file:com.glaf.core.id.MyBatisDbIdGenerator.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
protected synchronized void getNewBlock() {
    IdBlock idBlock = entityDAO.nextDbidBlock();
    this.nextId = idBlock.getNextId();
    this.lastId = idBlock.getLastId();
    if (logger.isDebugEnabled()) {
        logger.debug("----------------NEXTID------------------------");
        logger.debug("nextId:" + nextId);
        logger.debug("lastId:" + lastId);
    }/* w  w  w .ja  v  a2  s. co  m*/
}

From source file:gov.nih.nci.cabig.caaers.accesscontrol.dataproviders.FilteredDataLoader.java

@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
public void updateIndexByUserName(Authentication authentication) {
    String userName = SecurityUtils.getUserLoginName(authentication);
    long begin = System.currentTimeMillis();

    log.info("**BEGIN Updating Index for User " + userName);
    for (IdFetcher idFetcher : idFetchers) {
        long t1 = System.currentTimeMillis();
        List<IndexEntry> indexEntries = idFetcher.fetch(userName);
        long t2 = System.currentTimeMillis();
        log.info("TIME TOOK TO FETCH IDS " + idFetcher.getClass().getName() + " ..." + (t2 - t1) / 1000
                + " seconds");

        long t3 = System.currentTimeMillis();
        AbstractIndexDao indexDao = idFetcherIndexDaoMap.get(idFetcher);
        indexDao.updateIndex(userName, indexEntries);
        long t4 = System.currentTimeMillis();
        log.info("TIME TOOK TO UPDATE INDEX ..." + (t4 - t3) / 1000 + " seconds");
    }//from   w w w .j  a  va 2  s  .  c om
    log.info("**END Updating Index for User " + userName + ", total time : "
            + (System.currentTimeMillis() - begin) / 1000 + " seconds");

}

From source file:annis.administration.DeleteCorpusDao.java

/**
 * Deletes a top level corpus, when it is already exists.
 * @param corpusName/*  ww  w . ja va2 s.com*/
 */
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
public void checkAndRemoveTopLevelCorpus(String corpusName) {
    if (existConflictingTopLevelCorpus(corpusName)) {
        log.info("delete conflicting corpus: {}", corpusName);
        List<String> corpusNames = new LinkedList<>();
        corpusNames.add(corpusName);
        deleteCorpora(getAnnisDao().mapCorpusNamesToIds(corpusNames), false);
    }
}

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

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public User saveUser(User user) {
    if (user.getUserKey() == null) {
        user.setCreatedOn(new Date(System.currentTimeMillis()));
    }/* w  w w  . j  a v  a  2s .  c o m*/
    user = persist(user);
    return user;
}

From source file:com.ciphertool.zodiacengine.dao.CipherDao.java

@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
public Cipher findByCipherName(String name) {
    Query selectByNameQuery = new Query(Criteria.where("name").is(name));

    Cipher cipher = mongoOperations.findOne(selectByNameQuery, Cipher.class);

    return cipher;
}

From source file:com.ciphertool.zodiacengine.dao.SolutionDao.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
public boolean insert(SolutionChromosome solutionChromosome) {
    mongoOperations.insert(solutionChromosome);

    return true;
}

From source file:com.orange.clara.cloud.servicedbdumper.task.asynctask.DeleteDumpTask.java

@Async
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Future<Boolean> runTask(Integer jobId) throws AsyncTaskException {
    Job job = this.jobRepo.findOne(jobId);
    this.deleter.deleteAll(job.getDbDumperServiceInstance());
    this.jobFactory.createJobDeleteDbDumperServiceInstance(job.getDbDumperServiceInstance());

    job.setJobEvent(JobEvent.FINISHED);/*from  w w  w.  ja v a2 s . c o  m*/
    jobRepo.save(job);
    return new AsyncResult<Boolean>(true);
}

From source file:com.sshdemo.common.security.web.authentication.rememberme.JPAPersistentTokenRepository.java

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public void createNewToken(PersistentRememberMeToken token) {

    IPPersistentRememberMeToken rememberMeToken = (IPPersistentRememberMeToken) token;
    RememberMeToken model = new RememberMeToken();

    model.setId(token.getSeries());//from w w  w  . jav  a2  s  .  com
    model.setIpAddress(rememberMeToken.getIpAddress());
    model.setToken(token.getTokenValue());
    model.setUsername(token.getUsername());
    model.setLastUsed(new Date());

    rememberMeTokenDAO.persist(model);
}

From source file:org.jdbi.v3.spring4.DummyService.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_UNCOMMITTED)
public void inRequiresNewReadUncommitted(Callback c) {
    c.call(jdbi);
}