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:org.fits.proweb.business.UserComponent.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public void updateUser(User user) {
    userDao.updateUser(user);
}

From source file:com.springmvc.videoteca.spring.service.ClienteServiceImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void delete(int id) {
    clienteDAO.delete(id);
}

From source file:es.emergya.consultas.FlotaConsultas.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = true, rollbackFor = Throwable.class)
public static Flota find(Long id) {
    return flotaHome.find(id);
}

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

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

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

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public Tag saveTag(Tag tag) {
    Tag savedTag = getJdoTemplate().makePersistent(tag);
    return savedTag;
}

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

@Transactional(value = "txManager", propagation = Propagation.REQUIRED)
List<TheaterDB> getTheatersWithHalls();

From source file:com.mycompany.flooringmvc.dao.TaxesDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Tax create(Tax tax) {

    jdbcTemplate.update(SQL_INSERT_TAX, tax.getState(), tax.getTaxRate());

    Integer id = jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Integer.class);

    tax.setId(id);//from www . j a va  2  s .  c  o  m

    return tax;
}

From source file:com.Services.Impl.PlayerList.SoccerList_CrudImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public soccer_list remove(soccer_list entity) {
    return null;
}

From source file:com.xinferin.dao.DAOCustomerRegistrationImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void register(CustomerRegistration creg) throws Exception {

    DAOProductImpl daoProductImpl = new DAOProductImpl(dataSource);
    Product product = daoProductImpl.get(creg.getProduct());
    if (product == null)
        throw new ProductNotFoundException(creg.getProduct());

    DAOProviderImpl daoProviderImpl = new DAOProviderImpl(dataSource);
    Provider provider = daoProviderImpl.get(creg.getProvider());
    if (provider == null)
        throw new ProviderNotFoundException(creg.getProvider());

    // add a new customer
    DAOCustomerImpl daoCustomerImpl = new DAOCustomerImpl(dataSource);
    int customerId = daoCustomerImpl.add(creg.getCustomer());
    if (customerId < 0)
        throw new CustomerNotCreatedException();

    // register the new customer
    int registrationId = addRegistration(customerId, product.getId(), provider.getId(), creg.getLicenceType(),
            creg.getPrice());// ww  w . j  a v a2  s . c  o  m
    if (registrationId < 0)
        throw new RegistrationNotCreatedException();

    // first add the licence before updating with the newly generated licence id the key_info field
    Licence licence = new Licence();
    licence.setProduct_id(product.getId());

    DAOLicenceImpl daoLicenceImpl = new DAOLicenceImpl(dataSource);
    int licenceId = daoLicenceImpl.add(licence);
    licence.setId(licenceId);

    // use the LicenceGenerator to create a new licence key
    // LICENCE_ID | PRODUCT | CUSTOMER FULLNAME | CUSTOMER EMAIL | LICENCE TYPE | EXPIRY DATE

    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    String key_info = licenceId + "|" + creg.getProduct() + "|" + creg.getCustomer().getFname() + ", "
            + creg.getCustomer().getLname() + "|" + creg.getCustomer().getEmail() + "|" + creg.getLicenceType()
            + "|" + df.format(creg.getExpiryDate());

    LicenceGenerator lg = new LicenceGenerator(product.getLicence_params());
    byte[] generatedKey = lg.signData(key_info.getBytes());
    String signedB64 = Base64.encodeBase64String(generatedKey);

    // update the new licence with the generated key.
    licence.setKey_info(Base64.encodeBase64String(key_info.getBytes()));
    licence.setGenerated_key(signedB64);
    licence.setCustomer_key(UUID.randomUUID().toString());
    licence.setExpiry_date(creg.getExpiryDate());
    daoLicenceImpl.update(licence);

    // bind the registration with the licence.
    bindRegistrationAndLicence(registrationId, licenceId);
}

From source file:org.tutev.web.erp.service.BaseDao.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void delete(Object o) {
    getSession().delete(o);
}