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:com.oak_yoga_studio.dao.impl.CustomerDAOImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
@Override// ww  w  .j ava 2s.  c  o m
public List<Course> getAllCoursesToWaive(Customer customer) {

    List<Course> courses;
    String sql = "SELECT distinct co.* FROM COURSE co WHERE  co.id \n" + "               NOT IN\n"
            + "                (SELECT s.course_id FROM enrollment e  join customer c on c.id=e.customer_id\n"
            + "                  \n" + "                JOIN section s on s.id=e.section_id \n"
            + "                WHERE  c.id= " + customer.getId() + " AND e.status='COMPLETED'\n"
            + "                )\n"
            + "                AND co.id NOT IN ( SELECT waiverCourse_id from  waiver \n"
            + "                                  WHERE customer_id =" + customer.getId() + ")";

    SQLQuery query = sf.getCurrentSession().createSQLQuery(sql);
    query.addEntity(Course.class);
    courses = query.list();

    System.out.println("number of courses taken by customer is " + courses.size());
    return courses;

}

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

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

From source file:com.brienwheeler.svc.ledger.impl.LedgerService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork//from w  ww.  ja v a2s  .c o m
@GracefulShutdown
public List<LedgerEntry> getLedger(DbId<User> userId) {
    DbValidationUtils.assertPersisted(userId);
    return ledgerEntryDao.getLedger(userId.getId());
}

From source file:com.brienwheeler.lib.db.dao.NonDeletableDaoBase.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@SuppressWarnings("unchecked")
public List<EntityType> findAll() {
    return (List<EntityType>) entityManager.createQuery("from " + getEntityClass().getSimpleName())
            .getResultList();// w w  w.  ja  va 2s .  co m
}

From source file:org.ext4spring.parameter.DefaultParameterBeanService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public <T> T readParameterBean(Class<T> typeClass) throws ParameterException {
    return this.readParameterBean(typeClass, (String[]) null);
}

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

@Override
@Transactional(readOnly = false, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.SUPPORTS, timeout = 50)
public List<SmsGatewayUser> getAllByFullTextService(String parameter, int minResult, int maxResult, Order order)
        throws Exception {
    return userDao.getAllByFullTextService(parameter, minResult, maxResult, order);
}

From source file:com.brienwheeler.web.spring.security.UserDetailsService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    User user = null;// w  ww.ja  v a  2 s  .  c o m

    if (allowEmailLookup && EmailAddress.isValid(username))
        user = userEmailAddressService.findByEmailAddress(new EmailAddress(username));

    if ((user == null) && allowUsernameLookup)
        user = userService.findByUsername(username);

    if (user == null)
        throw new UsernameNotFoundException("username not found: " + username);

    List<String> roles = userRoleService.getUserRoles(user);
    List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
    for (String role : roles)
        authorities.add(new SimpleGrantedAuthority(role));

    return new com.brienwheeler.web.spring.security.UserDetails(user, authorities);
}

From source file:es.upm.fiware.rss.expenditureLimit.manager.test.ExpenditureLimitDataCheckerTest.java

/**
 * //from   w w w.j a  va2  s .  com
 */
@Transactional(propagation = Propagation.SUPPORTS)
public void checkChargeRequiredParametersTest() throws RSSException {
    ExpenditureLimitDataCheckerTest.logger.debug("Into checkChargeRequiredParametersTest mehtod");
    thrown.expect(RSSException.class);
    thrown.expectMessage(
            "Required parameters not found:enUserId, service, appProvider, currency, chargeType, amount.");
    checker.checkChargeRequiredParameters("urlEndUserId", "service", "aggId", "appPorviderId", "currency",
            "chargeType", new BigDecimal(10));
    ExpenditureLimitDataCheckerTest.logger.debug("No exception expected");
    checker.checkChargeRequiredParameters(null, "service", "aggId", "appPorviderId", "currency", "chargeType",
            new BigDecimal(10));

}

From source file:com.brienwheeler.svc.users.impl.UserEmailAddressService.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork/* w w  w.  j  a va  2  s . c  o  m*/
@GracefulShutdown
public User findByEmailAddress(EmailAddress emailAddress) {
    ValidationUtils.assertNotNull(emailAddress, "emailAddress cannot be null");

    UserEmailAddress userEmailAddress = userEmailAddressDao.findByEmailAddress(emailAddress);
    return userEmailAddress == null ? null : userEmailAddress.getUser();
}

From source file:com.devicehive.service.DeviceClassService.java

@Transactional(propagation = Propagation.SUPPORTS)
public DeviceClassWithEquipmentVO getWithEquipment(@NotNull Long id) {
    return deviceClassDao.find(id);
}