Example usage for org.hibernate Criteria setResultTransformer

List of usage examples for org.hibernate Criteria setResultTransformer

Introduction

In this page you can find the example usage for org.hibernate Criteria setResultTransformer.

Prototype

public Criteria setResultTransformer(ResultTransformer resultTransformer);

Source Link

Document

Set a strategy for handling the query results.

Usage

From source file:data.dao.FeatureDao.java

public List<Feature> getByCmgId(Long cmgId) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Restrictions.eq("cmgId", cmgId));
    //cr.addOrder(Order.asc("cmgId"));
    return cr.list();
}

From source file:data.dao.FreeValueRangeDao.java

public List<FreeValueRange> findByEventUid(FreeValueRange fvr) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.add(Property.forName("uid").eq(fvr.getUid()));
    cr.add(Property.forName("event").eq(fvr.getEvent()));
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:data.dao.parent.Dao.java

public List<T> getAllAsc(String... order) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    for (String ordPosition : order) {
        cr.addOrder(Order.asc(ordPosition));
    }/*from ww w .  j  av a 2 s  .  c o  m*/
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:data.dao.parent.Dao.java

public List<T> getAllDesc(String... order) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    for (String ordPosition : order) {
        cr.addOrder(Order.desc(ordPosition));
    }/*from  ww  w  .  ja  v  a 2  s.  c  o  m*/
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:data.dao.PropertyNameDao.java

public List<PropertyName> getPropertiesByCar(Long carId) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    if (carId != null) {

        cr.add(Property.forName("car_id").eq(carId));
        cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

    }/*from  w w  w  .  ja  v  a 2s . c om*/
    return cr.list();
}

From source file:data.dao.PropertyNameDao.java

public List<PropertyName> findByPropertyAndPnValue(PropertyName pn) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Property.forName("carProperty").eq(pn.getCarProperty()));
    cr.add(Property.forName("propertyNameValue").eq(pn.getPropertyNameValue()));
    return cr.list();
}

From source file:data.dao.SequenceValueRangeDao.java

public List<SequenceValueRange> findBySeqUid(SequenceValueRange svr) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.add(Property.forName("uid").eq(svr.getUid()));
    cr.add(Property.forName("sequence").eq(svr.getSequence()));
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:data.dao.SubModelDao.java

public List<SubModel> getAllSubs() {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:data.dao.ValueRangeDao.java

public List<ValueRange> findBySceneUid(ValueRange vr) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.add(Restrictions.eq("uid", vr.getUid()));
    cr.add(Restrictions.eq("scene", vr.getScene()));

    //cr.add(Property.forName("uid").eq(vr.getUid()));
    //cr.add(Property.forName("scene").eq(vr.getScene()));
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:de.appsolve.padelcampus.db.dao.generic.BaseEntityDAO.java

@SuppressWarnings("unchecked")
@Override//w ww  .j av  a  2  s.co m
public List<T> findAll() {
    Criteria criteria = getCriteria();
    criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    List<T> list = (List<T>) criteria.list();
    sort(list);
    return list;
}