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

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

Introduction

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

Prototype

Propagation REQUIRED

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

Click Source Link

Document

Support a current transaction, create a new one if none exists.

Usage

From source file:no.dusken.barweb.service.impl.PersonInvoiceServiceImpl.java

@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
public void savePersonsAndInvoice(List<BarPerson> barPersons, Invoice invoice) {
    barPersonService.save(barPersons);/*  ww w  .  j  av a  2 s.  c o m*/
    invoiceService.save(invoice);
}

From source file:com.filesprocessing.service.FilesProcessingService.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void update(Filesprocessing fProc) {
    filesProcDAO.update(fProc);
}

From source file:it.pronetics.madstore.repository.jcr.impl.JcrCollectionRepository.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public String putIfAbsent(final Element collectionElement) {
    if (collectionElement == null) {
        throw new IllegalArgumentException("Parameters cannot be null!");
    }//w  w w .  j  a va  2 s. c  om
    return (String) jcrTemplate.execute(new JcrCallback() {

        public Object doInJcr(Session session) throws IOException, RepositoryException {
            String key = collectionElement.getAttribute(AtomConstants.ATOM_KEY);
            if (!contains(key)) {
                importNodeFromDomCollection(key, collectionElement, session);
                session.save();
                return key;
            } else {
                return null;
            }
        }
    });
}

From source file:de.crowdcode.bitemporal.example.AddressServiceImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Address createAddress(Address address) {
    Address addressCreated = addressRepository.save(address);
    return addressCreated;
}

From source file:DataBaseAcessLayer.TransactionDAOImpl.java

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void removeTransaction(Transaction transaction) {
    org.hibernate.classic.Session session = hibernateTemplate.getSessionFactory().getCurrentSession();
    session.delete(transaction);// w  w  w  . j  a v  a  2 s .  co  m
    System.out.println(transaction.toString());
}

From source file:com.crowdmobile.dao.imp.GenericDAO.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public T salva(T entity) throws Exception {
    getHibernateTemplate().save(entity);
    getHibernateTemplate().flush();/*from   www  .  ja v a 2 s. c o  m*/
    return entity;
}

From source file:com.mycompany.capstone.dao.CommentDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Comment get(int id) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

From source file:com.enonic.cms.business.log.LogServiceImpl.java

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public LogEntryResultSet getLogEntries(LogEntrySpecification spec, String orderBy, final int count,
        final int index) {
    if (spec == null) {
        throw new IllegalArgumentException("Given LogEntrySpecification cannot be null");
    }//  www. java  2  s .  c  o m

    List<LogEntryKey> keys = logEntryDao.findBySpecification(spec, orderBy);

    final int queryResultTotalSize = keys.size();

    if (index > queryResultTotalSize) {
        return (LogEntryResultSet) new LogEntryResultSetNonLazy(index).addError(
                "Index greater than result count: " + index + " greater than " + queryResultTotalSize);
    }

    int toIndex = Math.min(queryResultTotalSize, count + index);

    LogEntryResultSet resultSet = new LogEntryResultSetLazyFetcher(new LogEntryEntityFetcherImpl(logEntryDao),
            keys.subList(index, toIndex), index, queryResultTotalSize);
    return resultSet;

}

From source file:org.openhie.openempi.service.PersonQueryService.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public Person getPersonByIdTransactionally(String tableName, long personId, List<String> fields);

From source file:com.swcguild.dvdlibraryarch.dao.DvdListDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public Dvd addDvd(Dvd dvd) {
    jdbcTemplate.update(SQL_INSERT_DVD, dvd.getTitle(), dvd.getDirector(), dvd.getReleasedate(),
            dvd.getMpaarating(), dvd.getStudio());
    dvd.setDvdId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class));
    return dvd;/*  w  w w  .  j av  a 2 s . co m*/
}