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:uk.ac.ebi.intact.editor.services.curate.experiment.ExperimentDetailedViewService.java

@Transactional(value = "jamiTransactionManager", propagation = Propagation.REQUIRED, readOnly = true)
public ExperimentWrapper loadExperimentWrapperByAc(String ac) {
    IntactExperiment experiment = experimentEditorService.loadExperimentByAc(ac);

    if (experiment != null) {
        return new ExperimentWrapper(experiment);
    } else {/*w w  w.  j a  v  a  2 s.  co m*/
        return null;
    }
}

From source file:com.mycompany.addressbookv4.dao.AddressBookDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public Address addAddress(Address address) {
    jdbcTemplate.update(SQL_INSERT_ADDRESS, address.getfName(), address.getlName(), address.getStreet(),
            address.getCity(), address.getState(), address.getZip());
    address.setAddressId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class));
    return address;
}

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

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Category get(int id) {
    return jdbcTemplate.queryForObject(SQL_GET_CATEGORY, new CategoryMapper(), id);
}

From source file:com.sg.addressbookmvc.dao.AddressBookDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public Address addAddress(Address address) {
    jdbcTemplate.update(SQL_INSERT_ADDRESS, address.getResidentLastName(), address.getStreetAddress(),
            address.getCityName(), address.getState(), address.getZipCode());
    address.setAddressId(jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Integer.class));
    return address;
}

From source file:com.tsguild.dolphinblog.dao.DolphinPostDaoImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public Post addPost(Post post) {
    jdbcTemplate.update(SQL_ADD_NEW_POST, post.getTitle(), post.getAuthor(), post.getCategoryId(),
            post.getPhotoUrl(), post.getContent(), post.getSynopsis());
    int postID = jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Integer.class);
    post.setPostID(postID);//from  ww w  . ja  v  a2  s  .c o m
    post.getPostID();
    for (int i = 0; i < post.getHashtags().size(); i++) {
        int hashtagID = jdbcTemplate.queryForObject(CONVERT_HASHTAGNAME_TO_HASHTAGID, Integer.class,
                post.getHashtags().get(i));
        jdbcTemplate.update(INSERT_A_POSTS_HASHTAGS, postID, hashtagID);
    }
    return post;
}

From source file:com.oak_yoga_studio.service.impl.FacultyServiceImpl.java

@Transactional(propagation = Propagation.REQUIRED)
@Override/*from   w w w. ja v a  2s .  co m*/
public void addFaculty(Faculty faculty) {
    try {
        facultyDAO.addFaculty(faculty);
    } catch (Exception e) {

    }
}

From source file:com.devicehive.service.IdentityProviderService.java

@Transactional(propagation = Propagation.REQUIRED)
public boolean delete(@NotNull String name) {
    return identityProviderDao.deleteById(name);
}

From source file:uk.ac.ebi.intact.editor.services.curate.organism.EditorBioSourceService.java

@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public IntactOrganism getBiosourceByTaxid(int taxid) throws BridgeFailedException {
    IntactOrganism biosource = intactDao.getOrganismDao().getByTaxidOnly(taxid);

    if (biosource == null) {
        Organism org = super.fetchByTaxID(taxid);
        biosource = new IntactOrganism(taxid);
        biosource.setCommonName(org.getCommonName());
        biosource.setScientificName(org.getScientificName());

        // copy collections
        for (Alias alias : org.getAliases()) {
            biosource.getAliases().add(new OrganismAlias(alias.getType(), alias.getName()));
        }/*from   w  w w.  j a  v  a2s  .c  o  m*/
    }

    return biosource;
}

From source file:ch.algotrader.service.StrategyPersistenceServiceImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public void persistStrategy(Strategy strategy) {

    Validate.notNull(strategy, "Strategy is null");

    strategyDao.save(strategy);//  ww  w  .  j av a 2 s  .c  om
}

From source file:com.lewischooman.services.IWebpageSrv.java

@Transactional(value = "txManager", propagation = Propagation.REQUIRED)
List<WebpageDB> getWebpages4Menu(HttpSession httpSession, String currentViewName);