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:org.skife.jdbi.v2.spring.DummyService.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void inRequiresNew(Callback c) {
    c.call(dbi);
}

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

@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
@Override/*  w w w . ja v  a2  s .  co  m*/
public void indexAll() throws Exception {
    System.out.println(" Do Indexingggggg");
    try {
        Session session = sessionFactory.getCurrentSession();

        FullTextSession fullTextSession = Search.getFullTextSession(session);
        fullTextSession.createIndexer().purgeAllOnStart(true).startAndWait();
        System.out.println(" Do Index Done");
    } catch (HibernateException | InterruptedException e) {
        throw e;
    }
}

From source file:com.Services.Impl.Employees.EmployeesCrudService.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Other_Employees merge(Other_Employees entity) {
    if (entity == null) {
        try {//  w ww . j  a v a 2 s  .  com
            throw new Exception();
        } catch (Exception ex) {
            Logger.getLogger(EmployeesCrudService.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    return entity;
}

From source file:cs544.letmegiveexam.service.SubjectService.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
public void addSubject(Subject subject) {
    subjectDao.addSubject(subject);
}

From source file:net.cpollet.jixture.sample.service.impl.SimpleUserService.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
public int getCommittedUsersCount() {
    return userDao.findAll().size();
}

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

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public Vote saveVote(Vote vote) {
    return getJdoTemplate().makePersistent(vote);
}

From source file:cs544.letmegiveexam.service.UserService.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
public void addUser(User user) {
    userDAO.add(user);
}

From source file:net.webpasswordsafe.server.plugin.audit.DatabaseAuditLogger.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void log(Date date, String user, String ip, String action, String target, boolean status,
        String message) {/*  w w  w . j a  va2s.c o m*/
    AuditLog auditLog = new AuditLog(date, user, ip, action, target, status, message);
    auditLogDAO.makePersistent(auditLog);
}

From source file:io.cloudslang.engine.queue.services.recovery.MessageRecoveryServiceImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public boolean recoverMessagesBulk(String workerName, int defaultPoolSize) {

    List<ExecutionMessage> messages = executionQueueService.pollRecovery(workerName, defaultPoolSize,
            ExecStatus.ASSIGNED, ExecStatus.SENT, ExecStatus.IN_PROGRESS);

    logMessageRecovery(messages);//w ww .  j a  va2 s.c om
    enqueueMessages(messages, ExecStatus.RECOVERED);
    //noinspection RedundantIfStatement
    if (messages == null || messages.size() < defaultPoolSize) {
        return false;
    }
    return true;
}

From source file:cs544.letmegiveexam.service.QuestionService.java

@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveQuestion(Question question) {
    crudfasade.save(question);
}