Example usage for org.hibernate.criterion CriteriaSpecification DISTINCT_ROOT_ENTITY

List of usage examples for org.hibernate.criterion CriteriaSpecification DISTINCT_ROOT_ENTITY

Introduction

In this page you can find the example usage for org.hibernate.criterion CriteriaSpecification DISTINCT_ROOT_ENTITY.

Prototype

ResultTransformer DISTINCT_ROOT_ENTITY

To view the source code for org.hibernate.criterion CriteriaSpecification DISTINCT_ROOT_ENTITY.

Click Source Link

Document

Each row of results is a distinct instance of the root entity

Usage

From source file:net.purnama.pureff.dao.PaymentInDao.java

public List getPaymentInList(Calendar begin, Calendar end, WarehouseEntity warehouse, PartnerEntity partner,
        CurrencyEntity currency, boolean status) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInEntity.class);
    c.add(Restrictions.between("date", begin, end));
    if (partner != null) {
        c.add(Restrictions.eq("partner", partner));
    }/*ww  w.  j  a v a  2 s  .  co m*/
    if (warehouse != null) {
        c.add(Restrictions.eq("warehouse", warehouse));
    }
    if (currency != null) {
        c.add(Restrictions.eq("currency", currency));
    }
    c.add(Restrictions.eq("status", status));
    c.addOrder(Order.asc("date"));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    List ls = c.list();
    return ls;
}

From source file:net.purnama.pureff.dao.PaymentInDraftDao.java

public List<PaymentInDraftEntity> getPaymentInDraftList() {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInDraftEntity.class);
    c.addOrder(Order.desc("date"));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInDraftDao.java

public List getPaymentInDraftList(int itemperpage, int page, String sort, String keyword, UserEntity user,
        WarehouseEntity warehouse) {/* w ww  .j  a  va 2 s  .co  m*/

    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInDraftEntity.class);
    c.add(Restrictions.like("id", "%" + keyword + "%"));
    c.add(Restrictions.eq("lastmodifiedby", user));
    c.add(Restrictions.eq("warehouse", warehouse));
    if (sort.contains("-")) {
        c.addOrder(Order.desc(sort.substring(1)));
    } else {
        c.addOrder(Order.asc(sort));
    }
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    c.setFirstResult(itemperpage * (page - 1));
    c.setMaxResults(itemperpage);

    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInInvoiceSalesDao.java

public List<PaymentInInvoiceSalesEntity> getPaymentInInvoiceSalesEntityList(PaymentInEntity paymentin) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInInvoiceSalesEntity.class);
    c.add(Restrictions.eq("paymentin", paymentin));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInInvoiceSalesDao.java

public List<PaymentInInvoiceSalesEntity> getPaymentInInvoiceSalesEntityList(InvoiceSalesEntity invoicesales) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInInvoiceSalesEntity.class);
    c.add(Restrictions.eq("invoicesales", invoicesales));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInInvoiceSalesDraftDao.java

public List<PaymentInInvoiceSalesDraftEntity> getPaymentInInvoiceSalesDraftEntityList(
        PaymentInDraftEntity paymentindraft) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInInvoiceSalesDraftEntity.class);
    c.add(Restrictions.eq("paymentindraft", paymentindraft));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInInvoiceSalesDraftDao.java

public List<PaymentInInvoiceSalesDraftEntity> getPaymentInInvoiceSalesDraftEntityList(
        PaymentInDraftEntity paymentindraft, PartnerEntity partner, CurrencyEntity currency) {
    Session session = this.sessionFactory.getCurrentSession();

    Criteria c = session.createCriteria(PaymentInInvoiceSalesDraftEntity.class, "paymentininvoicesalesdraft");
    c.add(Restrictions.eq("paymentindraft", paymentindraft));
    c.createAlias("paymentininvoicesalesdraft.invoicesales", "invoicesales");
    c.add(Restrictions.eq("invoicesales.partner", partner));
    c.add(Restrictions.eq("invoicesales.currency", currency));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInReturnSalesDao.java

public List<PaymentInReturnSalesEntity> getPaymentInReturnSalesEntityList(PaymentInEntity paymentin) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInReturnSalesEntity.class);
    c.add(Restrictions.eq("paymentin", paymentin));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInReturnSalesDao.java

public List<PaymentInReturnSalesEntity> getPaymentInReturnSalesEntityList(ReturnSalesEntity returnsales) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInReturnSalesEntity.class);
    c.add(Restrictions.eq("returnsales", returnsales));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}

From source file:net.purnama.pureff.dao.PaymentInReturnSalesDraftDao.java

public List<PaymentInReturnSalesDraftEntity> getPaymentInReturnSalesDraftEntityList(
        PaymentInDraftEntity paymentindraft) {
    Session session = this.sessionFactory.getCurrentSession();
    Criteria c = session.createCriteria(PaymentInReturnSalesDraftEntity.class);
    c.add(Restrictions.eq("paymentindraft", paymentindraft));
    c.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    return c.list();
}