Example usage for org.springframework.transaction.annotation Propagation SUPPORTS

List of usage examples for org.springframework.transaction.annotation Propagation SUPPORTS

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Propagation SUPPORTS.

Prototype

Propagation SUPPORTS

To view the source code for org.springframework.transaction.annotation Propagation SUPPORTS.

Click Source Link

Document

Support a current transaction, execute non-transactionally if none exists.

Usage

From source file:it.geosolutions.geobatch.users.dao.hibernate.HibGBUserDAO.java

@Transactional(propagation = Propagation.SUPPORTS)
public GBUser findByUserName(String userName) throws DAOException {
    List<GBUser> users = super.findByCriteria(Restrictions.eq("name", userName));
    if (users.size() > 0)
        return users.get(0);
    return null;/*from   www . j  a v a  2s.  c  o m*/
}

From source file:it.geosdi.era.server.dao.hibernate.DAOStratoProgettoHibernate.java

@Transactional(propagation = Propagation.SUPPORTS)
public StratoProgetto findById(long idStratoProgetto) {
    try {//from  w w  w. j  a  v a 2 s . c om
        List<StratoProgetto> listaStratiProgetto = findByCriteria(Restrictions.eq("id", idStratoProgetto));
        if (listaStratiProgetto.size() != 0)
            return listaStratiProgetto.get(0);
    } catch (HibernateException e) {
        logger.error(e);
        throw new DAOException(e.getMessage());
    }
    return null;
}

From source file:de.crowdcode.bitemporal.example.AddressServiceImpl.java

@Override
@Transactional(propagation = Propagation.SUPPORTS)
public String findRevisionNumberByAddressIdAndRevisionNumber(Long addressId, Integer revisionNumber) {
    Number number = addressRepository.findRevisionNumberByAddressIdAndRevisionNumber(addressId, revisionNumber);
    return number.toString();
}

From source file:org.newinstance.tnt.service.TaskServiceImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
public List<Task> searchAllTask() {
    LOG.log(Level.INFO, "Searching all tasks.");
    // convert Iterable to something more useful
    final List<Task> taskList = new ArrayList<>();
    final Iterable<Task> result = taskRepository.findAll();
    for (final Task task : result) {
        taskList.add(task);/*  w  w  w.j a v  a 2s. co  m*/
    }
    return taskList;
}

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

@Transactional(propagation = Propagation.SUPPORTS)
@Override//from   w w  w .jav  a  2s  . c  om
public Faculty getFacultyById(int Id) {
    try {
        return facultyDAO.getFaculty(Id);
    } catch (Exception e) {
        return null;
    }
}

From source file:org.nebulae2us.stardust.example.service.impl.CommentServiceImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
public List<Comment> getComments(List<Filter> filters) {

    List<Comment> comments = daoManager.newQuery(Comment.class).innerJoin("commenter", "p")
            .outerJoin("tags", "t").filterBy(filters).orderBy("createdDate").orderBy("t.name").list();

    return comments;
}

From source file:org.apigw.authserver.svc.impl.CertifiedClientDetailsServiceImpl.java

@Override
@Transactional(propagation = Propagation.SUPPORTS)
public CertifiedClient loadClientByX509Cert(String issuerDN, String subjectDN) {
    log.trace("loadClientByX509Cert(issuerDN:{}, subjectDN:{})", issuerDN, subjectDN);
    CertifiedClient certifiedClient = certifiedClientRepository.findClientByIssuerDnAndSubjectDnEager(issuerDN,
            subjectDN);/*from ww w  .  j  a v  a 2 s  . c o  m*/
    if (certifiedClient == null) {
        log.warn("No client with issuer DN {} and subject DN {} found", issuerDN, subjectDN);
        throw new UsernameNotFoundException("No client for the provided certificate found");
    }
    log.trace("returning CertifiedClient from loadClientByX509Cert");
    return certifiedClient;
}

From source file:com.brienwheeler.svc.usergroups.impl.UserGroupMemberDao.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@SuppressWarnings("unchecked")
public List<UserGroupMember> findForGroup(UserGroup userGroup) {
    Query query = entityManager.createQuery("from UserGroupMember where userGroup = :userGroup");
    query.setParameter("userGroup", userGroup);
    return (List<UserGroupMember>) query.getResultList();
}

From source file:com.brienwheeler.svc.usergroups.impl.UserGroupService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork//from  www  . j  av a2  s. c  om
@GracefulShutdown
public UserGroup findByNameAndType(String groupName, String groupType) {
    groupName = ValidationUtils.assertNotEmpty(groupName, "groupName cannot be empty");
    groupType = ValidationUtils.assertNotEmpty(groupType, "groupType cannot be empty");

    return userGroupDao.findByNameAndType(groupName, groupType);
}

From source file:com.bsb.cms.moss.service.impl.auth.SysUserServiceImpl.java

@Override
@Transactional(propagation = Propagation.SUPPORTS)
public boolean isRename(String name) {
    Long count = sysUserMapper.hasRename(name);// ?
    return (count != null && count > 0) ? true : false;
}