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:it.pronetics.madstore.server.jaxrs.atom.pub.impl.DefaultEntryResourceHandler.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
@ResourceUriFor(resource = ResourceName.ENTRY)
@GET//from   w ww .j  a v a  2 s . c om
@Path("/{collectionKey}/{entryKey}")
@Produces(AtomConstants.ATOM_MEDIA_TYPE)
public Response getEntryResource() {
    try {
        Entry entry = readEntryFromRepository(collectionKey, entryKey);
        Response response = buildOkResponse(entry);
        return response;
    } catch (Exception ex) {
        LOG.error(ex.getMessage(), ex);
        throw new WebApplicationException(Response.serverError().build());
    }
}

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

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

From source file:uk.ac.ebi.intact.editor.services.curate.institution.InstitutionService.java

@Transactional(value = "jamiTransactionManager", propagation = Propagation.REQUIRED, readOnly = true)
public void loadInstitutions() {
    if (log.isDebugEnabled())
        log.debug("Loading Institutions");

    synchronized (this) {
        this.institutionSelectItems = null;
        List<IntactSource> allInstitutions = getIntactDao().getSourceDao().getAllSorted(0, Integer.MAX_VALUE,
                "shortName", true);

        institutionSelectItems = new ArrayList<SelectItem>(allInstitutions.size());

        for (IntactSource institution : allInstitutions) {
            institutionSelectItems//  www  . java2 s .  co  m
                    .add(new SelectItem(institution, institution.getShortName(), institution.getFullName()));
        }

        isInitialised = true;
    }
}

From source file:cs544.wamp_blog_engine.service.impl.CategoryTagService.java

@Transactional(propagation = Propagation.REQUIRED)
@Override
public void updateCategory(Category category) {
    categoryDAO.updateCategory(category);
}

From source file:org.yamj.core.service.staging.StagingService.java

@Transactional(propagation = Propagation.REQUIRED)
public Library storeLibrary(ImportDTO libraryDTO) {
    Library library = stagingDao.getLibrary(libraryDTO.getClient(), libraryDTO.getPlayerPath());
    if (library == null) {
        library = new Library();
        library.setClient(libraryDTO.getClient());
        library.setPlayerPath(libraryDTO.getPlayerPath());
    }/*from w  w  w.j  a va2  s.c om*/
    library.setBaseDirectory(FilenameUtils.normalizeNoEndSeparator(libraryDTO.getBaseDirectory(), true));
    library.setLastScanned(new Date(System.currentTimeMillis()));
    stagingDao.storeEntity(library);
    return library;
}

From source file:com.jfootball.business.impl.CareerServiceImpl.java

@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveEntity(Serializable obj) {
    Career career = (Career) obj;
    careerDAO.saveOrUpdateCareer(career);
}

From source file:it.geosolutions.geobatch.ftpserver.dao.hibernate.HibFtpPropsDAO.java

@Transactional(propagation = Propagation.REQUIRED)
public void delete(FtpProps props) throws DAOException {
    super.makeTransient(props);
}

From source file:com.samples.platform.serviceprovider.library.internal.dao.PlatformDao.java

/**
 * @param value//from w w w.j a  v  a  2s .  c o  m
 *            the {@link BookType} to create.
 * @return the created {@link BookType}.
 */
@Transactional(value = PersistenceConfig.TRANSACTION_MANAGER_NAME, propagation = Propagation.REQUIRED)
public BookType createBook(final BookType value) {
    if (value != null) {
        try {
            this.em.persist(value);
            this.logger.debug("createBook id=" + value.getUUID());
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
        return value;
    } else {
        this.logger.debug("createBook: value is null.");
        return null;
    }
}

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

@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public List<Person> getPersonsByIdsTransactionally(String tableName, List<Long> personIds);

From source file:com.enonic.cms.core.vacuum.VacuumServiceImpl.java

/**
 * Clean read logs.//from   www  .j a v  a2  s  .co  m
 */
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void cleanReadLogs() {
    if (progressInfo.isInProgress() || !isAdmin()) {
        return;
    }

    try {
        startProgress("Cleaning read logs...");

        final Connection conn = connectionFactory.getConnection(true);

        setProgress("Vacuum read logs...", 5);

        vacuumReadLogs(conn);
    } catch (final Exception e) {
        setProgress("Failed to clean read logs: " + e.getMessage(), 100);
        progressInfo.setInProgress(false);

        throw new RuntimeException("Failed to clean read logs", e);
    } finally {
        finishProgress();
    }
}