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 List<User> getAllUsers() {
    return userDao.getAllUsers();
}

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

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

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

@Transactional(propagation = Propagation.REQUIRED)
@Override//  w  w  w .jav a  2s . c  o  m
public Course getCourseById(int Id) {
    try {
        return courseDAO.getCourse(Id);
    } catch (Exception e) {
        return null;
    }
}

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

@Transactional(value = "txManager", propagation = Propagation.REQUIRED)
Status getViewPermissions(String viewName, HttpSession httpSession);

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

@Transactional(propagation = Propagation.REQUIRED)
@Override/*  w ww .  j av a 2  s  .c o  m*/
public List<Section> getListOfSections() {
    try {
        return sectionDAO.getAllSections();
    } catch (Exception e) {
        return new ArrayList();
    }

}

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

@Transactional(value = "txManager", propagation = Propagation.REQUIRED)
List<TheaterDB> getMovieShowsByDateTheater(Date dateFrom, int additionalDays, Integer theaterId);

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

/**
 * Inserta un regla programada en la BD.
 *
 * @param reglaProgramada//from w  w w . ja  va  2  s  .co m
 * @throws ReglaProgramadaErrorPersistir
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = es.ujaen.iambiental.excepciones.ReglaProgramadaErrorPersistir.class)
public void insertar(ReglaProgramada reglaProgramada) throws ReglaProgramadaErrorPersistir {
    try {
        em.persist(reglaProgramada);
        em.flush();
    } catch (Exception e) {
        throw new ReglaProgramadaErrorPersistir();
    }
}

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

/**
 * Inserta un tarea programada en la BD.
 *
 * @param tareaProgramada/*from ww w  .ja v  a  2 s . c o  m*/
 * @throws TareaProgramadaErrorPersistir
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = es.ujaen.iambiental.excepciones.TareaProgramadaErrorPersistir.class)
public void insertar(TareaProgramada tareaProgramada) throws TareaProgramadaErrorPersistir {
    try {
        em.persist(tareaProgramada);
        em.flush();
    } catch (Exception e) {
        throw new TareaProgramadaErrorPersistir();
    }
}

From source file:es.emergya.actions.Authentication.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Throwable.class)
public static void logOut() {
    try {/*from   w ww.j a  v a2  s  . c o m*/
        u = null;
        ClienteConectado actual = clienteConectadoHome.get(id);
        if (actual != null)
            clienteConectadoHome.remove(id);
    } catch (ObjectRetrievalFailureException t) {
        log.error("Parece que nos han echado, independientemente de nuestro logout. " + t.toString());
    } catch (Throwable t) {
        log.error("Error al hacer logout", t);
        // } finally {
        // id = nextId();
    }
}

From source file:gov.nih.nci.protexpress.service.impl.ProtExpressServiceImpl.java

/**
 * {@inheritDoc}/*w ww  .j a  va2  s. c  om*/
 */
@Transactional(readOnly = true, propagation = Propagation.REQUIRED)
public boolean isFieldUnique(PersistentObject bean, String fieldName, Object fieldValue) {
    Class persistentClass = bean.getClass();
    if (bean instanceof HibernateProxy) {
        persistentClass = ((HibernateProxy) bean).getHibernateLazyInitializer().getPersistentClass();
    }
    StringBuffer hql = new StringBuffer("from " + persistentClass.getName() + " where " + fieldName + " = ?");
    Object[] args = null;
    if (bean.getId() != null) {
        hql.append(" and id != ?");
        args = new Object[] { fieldValue, bean.getId() };
    } else {
        args = new Object[] { fieldValue };
    }
    List objects = getHibernateTemplate().find(hql.toString(), args);
    if (objects.size() > 0) {
        return false;
    }
    return true;
}