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:com.rajtech.stockwebservice.dao.Impl.SalesDaoImpl.java

@Override
public List<SalesMaster> findByPage(int page, int no_of_record) {
    List<SalesMaster> salesMasters = null;
    if (page == 0) {
        page = 1;//from ww w.ja va  2  s. com
    }
    int indexPage = (page * no_of_record) - no_of_record;
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    criteria.setFirstResult(indexPage);
    criteria.setMaxResults(no_of_record);
    salesMasters = criteria.list();
    return salesMasters;
}

From source file:com.rajtech.stockwebservice.dao.Impl.StatesDaoImpl.java

@Override
public List<States> findByAll() {
    List<States> stateses = null;
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    stateses = criteria.list();//  w  ww  . j  a  va 2  s. co m
    return stateses;
}

From source file:com.rajtech.stockwebservice.dao.Impl.StockImpl.java

@Override
public List<ManufacturedStocks> findAll() {
    List<ManufacturedStocks> manufacturedStocks = null;
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    manufacturedStocks = crit.list();//w w w  . jav  a2 s.c  o  m
    return manufacturedStocks;
}

From source file:com.rajtech.stockwebservice.dao.Impl.StockImpl.java

@Override
public List<ManufacturedStocks> findByPage(int page, int no_of_record) {
    List<ManufacturedStocks> manufacturedStockses = null;
    if (page == 0) {
        page = 1;//from  w  w  w  .j  a  v  a  2 s. co m
    }
    int indexPage = (page * no_of_record) - no_of_record;
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    criteria.setFirstResult(indexPage);
    criteria.setMaxResults(no_of_record);
    manufacturedStockses = criteria.list();
    return manufacturedStockses;
}

From source file:com.rajtech.stockwebservice.dao.Impl.StockPackingDaoImpl.java

@Override
public List<StockPacking> findAll() {
    List<StockPacking> stockPackings = null;
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    stockPackings = crit.list();/*  w  ww. ja va2  s  .c  om*/
    return stockPackings;

}

From source file:com.rajtech.stockwebservice.dao.Impl.StockPackingDaoImpl.java

@Override
public List<StockPacking> findByPage(int page, int no_of_record) {
    List<StockPacking> stockPackings = null;
    if (page == 0) {
        page = 1;/*  w  ww.j a  va 2s  . co m*/
    }
    int indexPage = (page * no_of_record) - no_of_record;
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    criteria.setFirstResult(indexPage);
    criteria.setMaxResults(no_of_record);
    stockPackings = criteria.list();
    return stockPackings;
}

From source file:com.rajtech.stockwebservice.dao.Impl.TaxDaoImpl.java

@Override
public List<Tax> findAll() {
    List<Tax> taxs = null;/*from  w w w . j  a v a  2s  .co  m*/
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    taxs = crit.list();
    return taxs;
}

From source file:com.rajtech.stockwebservice.dao.Impl.TaxDaoImpl.java

@Override
public List<Tax> findByPage(int page, int no_of_record) {
    List<Tax> taxs = null;//w w  w. j  av  a 2  s  .  c  o  m
    if (page == 0) {
        page = 1;
    }
    int indexPage = (page * no_of_record) - no_of_record;
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    criteria.setFirstResult(indexPage);
    criteria.setMaxResults(no_of_record);
    taxs = criteria.list();
    return taxs;
}

From source file:com.redhat.rhn.domain.kickstart.KickstartFactory.java

License:Open Source License

/**
 * Lookup a list of all KickstartData objects located on the Satellite
 *  Should not be used by much.  Ignores org!
 * @return List of KickstartData objects if found
 *//* w w  w. j  a va 2s  .com*/
public static List<KickstartData> listAllKickstartData() {
    Session session = getSession();
    Criteria c = session.createCriteria(KickstartData.class);
    // Hibernate does not filter out duplicate references by default
    c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:com.romeikat.datamessie.core.base.query.entity.execute.AbstractEntityQueryExecutor.java

License:Open Source License

public void applyResultTransformer(final ResultTransformer resultTransformer, final Criteria criteria) {
    if (resultTransformer != null) {
        criteria.setResultTransformer(resultTransformer);
    }/*from ww  w  .  j  ava  2  s .  c  o m*/
}