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:dao.NinoDaoImpl.java

@Override
public List<Nino> findAll() {
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates.
    List<Nino> nino = (List<Nino>) criteria.list();

    return nino;/*from   w  ww  . ja  v a2  s  .c  om*/
}

From source file:dao.NoticiaDaoImpl.java

@Override
public List<Noticia> findAll() {
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates.
    List<Noticia> noticia = (List<Noticia>) criteria.list();

    return noticia;
}

From source file:dao.parent.Dao.java

public List<T> getAll() {
    Criteria cr = getCurrentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return cr.list();
}

From source file:dao.parent.Dao.java

protected Criteria getCriteriaDistinctRoot(Class cl) {
    Criteria crit = getCurrentSession().createCriteria(cl);
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return crit;// w ww  . j  a v a 2s  .c om
}

From source file:dao.ProfesorDaoImpl.java

@Override
public List<Profesor> findAll() {
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates.
    List<Profesor> profesor = (List<Profesor>) criteria.list();

    return profesor;
}

From source file:dao.RequerimientoDaoImpl.java

@Override
public List<Requerimiento> findAll() {
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates.
    List<Requerimiento> contacto = (List<Requerimiento>) criteria.list();

    return contacto;
}

From source file:data.dao.CarDao.java

public List<Car> getCarLesserPrice(BigDecimal price) {

    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Restrictions.le("cmPrice", price.doubleValue()));
    cr.add(Restrictions.gt("cmPrice", Double.valueOf("0.0")));
    return cr.list();
}

From source file:data.dao.CarDao.java

public List<Car> findById(Long oldId) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Restrictions.eq("cmqId", oldId));
    return cr.list();
}

From source file:data.dao.ColorDao.java

public List<Color> findByQId(Long oldId) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Restrictions.eq("oldId", oldId));
    return cr.list();
}

From source file:data.dao.ColorGroupDao.java

public List<ColorGroup> findByQId(Long oldId) {
    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Restrictions.eq("oldId", oldId));
    return cr.list();
}