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.CountriesDaoImpl.java

@Override
public List<Countries> findByAll() {
    List<Countries> countryList = null;
    Criteria criteria = createEntityCriteria();
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    countryList = criteria.list();//from   w w w. j  a  v a 2s  . c om
    return countryList;
}

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

@Override
public List<Customer> findAll() {
    List<Customer> customers = null;
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    customers = crit.list();//ww w . j a  va2 s. c om
    return customers;
}

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

@Override
public List<Customer> findByPage(int page, int no_of_record) {
    List<Customer> customers = null;
    if (page == 0) {
        page = 1;//from w w  w .j  a v a2s  .c  o 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);
    customers = criteria.list();
    return customers;
}

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

@Override
public List<PackagesSize> findAllCategories() {
    List<PackagesSize> packagesSizes = null;
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    packagesSizes = crit.list();/*from   w  w  w .  jav a2  s.c  o  m*/
    return packagesSizes;
}

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

@Override
public List<PackagesSize> findByPage(int page, int no_of_record) {
    List<PackagesSize> packagesSizes = null;
    if (page == 0) {
        page = 1;/*from ww w . j a v  a2s  .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);
    packagesSizes = criteria.list();
    return packagesSizes;
}

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

@Override
public List<PackMaster> findAllCategories() {
    List<PackMaster> packMasters = null;
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    packMasters = crit.list();//w  ww . ja  v a2 s. c om
    return packMasters;
}

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

@Override
public List<PackMaster> findByPage(int page, int no_of_record) {
    List<PackMaster> packMasters = 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);
    packMasters = criteria.list();
    return packMasters;
}

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

@Override
public List<PurchaseMaster> findByPage(int page, int no_of_record) {
    List<PurchaseMaster> purchaseMasters = null;
    if (page == 0) {
        page = 1;//ww  w  .  jav a 2s. c o  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);
    purchaseMasters = criteria.list();
    return purchaseMasters;
}

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

@SuppressWarnings("unchecked")
public List<Roles> getRoles() {
    List<Roles> roles;//  www . j ava 2 s  .  c  o  m
    Criteria crit = createEntityCriteria();
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    roles = (List<Roles>) crit.list();
    return roles;
}

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

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