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:com.mycompany.capstone.dao.ImageDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Image get(int id) {
    return jdbcTemplate.queryForObject(SQL_GET_IMAGE_IN_STATIC_PAGE_BY_ID, new AdminPagesImageMapper(), id);
}

From source file:uk.ac.ebi.intact.editor.services.UserSessionService.java

@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public User loadUser(String login) {
    User user = getIntactDao().getUserDao().getByLogin(login);
    if (user != null && user.getAc() != null) {
        Hibernate.initialize(user.getRoles());
        Hibernate.initialize(user.getPreferences());
    }//from  ww w .  ja  va  2s  .  co  m

    return user;
}

From source file:uk.ac.ebi.intact.editor.services.summary.OrganismSummaryService.java

@Override
@Transactional(propagation = Propagation.REQUIRED, value = "jamiTransactionManager", readOnly = true)
public long countAll() {
    return this.organismService.countAll();
}

From source file:uk.ac.ebi.intact.editor.services.summary.CvSummaryService.java

@Override
@Transactional(propagation = Propagation.REQUIRED, value = "jamiTransactionManager", readOnly = true)
public long countAll() {
    return this.cvTermService.countAll();
}

From source file:uk.ac.ebi.intact.editor.services.curate.publication.PublicationEditorService.java

@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public int countAnnotations(IntactPublication publication) {
    return getIntactDao().getPublicationDao().countAnnotationsForPublication(publication.getAc());
}

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

@Transactional(propagation = Propagation.REQUIRED)
@Override//w  ww.j a  v a 2  s  . c  om
public void updateFaculty(int id, Faculty faculty) {
    try {
        Faculty f = facultyDAO.getFaculty(id);
        f.setFirstName(faculty.getFirstName());
        f.setLastName(faculty.getLastName());
        f.setDateOfBirth(faculty.getDateOfBirth());
        f.setEmail(faculty.getEmail());
        f.setProfilePicture(faculty.getProfilePicture());
        f.getCredential().setActive(faculty.getCredential().isActive());
        facultyDAO.updateFaculty(f);
    } catch (Exception ex) {
        System.out.println("Error:" + ex.getMessage());
    }

}

From source file:com.tsg.cms.dao.UserDbDaoImpl.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override//w w  w .  j  a  v  a  2 s. c  om
public User addUser(User user) {
    jdbcTemplate.update(SQL_INSERT_USER, user.getUserName(), user.getPassword(), 1);
    user.setUserId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class));
    return user;
}

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

@Override
@Transactional(propagation = Propagation.REQUIRED)
public double getTax(String state) {
    Tax tax = jdbcTemplate.queryForObject(SQL_GET_TAX_STATE, new TaxMapper(), state);
    double rate = tax.getTaxRate();
    return rate;/*from  w  w  w.j  a  v a2  s . c o m*/
}

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

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Strategy getOrCreateStrategy(String name) {

    Validate.notNull(name, "Name is null");

    Strategy strategy = strategyDao.findByName(name);
    if (strategy == null) {
        strategy = Strategy.Factory.newInstance(name, true);
        strategyDao.save(strategy);/*ww w . jav a2  s  . c  om*/
    }
    return strategy;
}

From source file:DataBaseAcessLayer.TransactionDAOImpl.java

@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveTransaction(Transaction transaction) {
    org.hibernate.classic.Session session = hibernateTemplate.getSessionFactory().getCurrentSession();
    session.saveOrUpdate(transaction);/*from w w  w .ja  v a  2  s.co m*/

    System.out.println(transaction.toString());
}