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.openhie.openempi.service.PersonQueryService.java

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

From source file:com.Services.Impl.PlayerRecords.GoalScorer_CrudImpl.java

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

From source file:dao.DAOPeticionAmistad.java

/**
 * //  www  . j  ava 2 s.  c  o  m
 * @param _peticion 
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = exceptionsDAO.BorrarPeticionAmistadException.class)
public void borrarPeticionAmistad(PeticionAmistad _peticion) {
    em.remove(em.merge(_peticion));
}

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

@Transactional(value = "txManager", propagation = Propagation.REQUIRED)
Status register(Integer[] id, String longName, String password, String... othFlds);

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

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Order create(Order order) {

    jdbc.update(SQL_INSERT_ORDER, order.getName(), order.getDate(), order.getArea(), order.getProductId(),
            order.getStateId(), order.getTotal());

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

    order.setId(id);/*from  w  w  w  . java2  s  . c om*/

    return order;

}

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

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public boolean saveRequest(AdminRequest adminRequest) {
    adminRequest = getJdoTemplate().makePersistent(adminRequest);
    if (adminRequest != null && !StringUtils.isBlank(adminRequest.getKey())) {
        logger.info("Admin Request for " + adminRequest.getRequestType() + " " + adminRequest.getEntityType()
                + " saved successfully");
        return true;
    }/*from www . ja va2 s. c  o m*/
    logger.error("Saving of AdminRequest object failed");
    return false;
}

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

@Override
@Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void onMessage(Message message) {
    try {//  www.  j a  v  a 2s .co m

        LOGGER.info("Sending SMS Begin");
        TextMessage textMessage = (TextMessage) message;
        String json = textMessage.getText();
        SMSSend smss = (SMSSend) jsonConverter.getClassFromJson(json, SMSSend.class);
        LOGGER.info("Sending Messages " + smss.getContent());
        LOGGER.info("Sending Messages " + smss.getDestination());
        SmsActivity activity = new SmsActivity();
        activity.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9)));
        activity.setContentSms(smss.getContent());
        activity.setDestination(smss.getDestination());
        activity.setIsSchedule(false);
        activity.setFromSms(smss.getFrom());
        activity.setIsSend(true);
        activity.setSendDate(new Date());
        activity.setSendTime(new Date());
        activity.setPriceSms(smss.getPricePerSms());
        smsActivityDao.save(activity);
        OutboundMessage msg = new OutboundMessage(smss.getDestination(), smss.getContent());
        msg.setFlashSms(false);
        if (smss.getModemId() == null) {
            Service.getInstance().sendMessage(msg);
        } else {
            Service.getInstance().sendMessage(msg, smss.getModemId());
        }

        LOGGER.info("Sending SMS Done");
    } catch (Exception ex) {
        LOGGER.error("Error", ex);
    }
    //        } catch (JMSException | TimeoutException | GatewayException | IOException | InterruptedException ex) {
    //            LOGGER.error("Error", ex);
    //        }
}

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

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Image create(Image adminPageImage) {
    jdbcTemplate.update(SQL_INSERT_IMAGE_IN_STATIC_PAGE,

            adminPageImage.getImageData(), adminPageImage.getImagePath());

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

    adminPageImage.setId(id);/*www.j a v  a 2  s  .co  m*/

    return adminPageImage;
}

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

@Transactional(propagation = Propagation.REQUIRED)
@Override
public void deleteTag(Tag tag) {
    tagDAO.removeTag(tag);
}

From source file:es.ujaen.iambiental.daos.DependenciaDAO.java

/**
 * Inserta un dependencia en la BD./* www . j av  a 2 s.  c  o m*/
 *
 * @param dependencia
 * @throws DependenciaErrorPersistir
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = es.ujaen.iambiental.excepciones.SensorErrorPersistir.class)
public void insertar(Dependencia dependencia) throws DependenciaErrorPersistir {
    try {
        em.persist(dependencia);
        em.flush();
    } catch (Exception e) {
        throw new DependenciaErrorPersistir();
    }
}