Example usage for org.hibernate Criteria setMaxResults

List of usage examples for org.hibernate Criteria setMaxResults

Introduction

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

Prototype

public Criteria setMaxResults(int maxResults);

Source Link

Document

Set a limit upon the number of objects to be retrieved.

Usage

From source file:com.algoTrader.entity.marketData.MarketDataEventDefinitionDaoBase.java

/**
 * {@inheritDoc}// w ww  .j  a  v a 2  s.co m
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(MarketDataEventDefinitionImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.marketData.NumericMarketDataEventDaoBase.java

/**
 * {@inheritDoc}//from  www .ja va  2 s  .com
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(NumericMarketDataEventImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.marketData.TextualMarketDataEventDaoBase.java

/**
 * {@inheritDoc}//from   w w  w.j a v  a  2s.c om
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(TextualMarketDataEventImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.marketData.TickDaoBase.java

/**
 * {@inheritDoc}/*from w w w  .  j a v a 2 s  .  c  o  m*/
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(TickImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.PositionDaoBase.java

/**
 * {@inheritDoc}//  w  ww .j ava  2s. c o m
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(PositionImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.security.EquityIndexDaoBase.java

/**
 * {@inheritDoc}//from w ww .j  av a 2  s .co  m
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(EquityIndexImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.security.ForexDaoBase.java

/**
 * {@inheritDoc}//from  w ww  .jav  a  2 s  .  c om
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(ForexImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.security.FutureDaoBase.java

/**
 * {@inheritDoc}//from  w ww .j  a va 2s. co  m
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(FutureImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.security.IntrestRateDaoBase.java

/**
 * {@inheritDoc}//from   www  . ja v a 2s.  c  om
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(IntrestRateImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}

From source file:com.algoTrader.entity.security.SecurityDaoBase.java

/**
 * {@inheritDoc}// w  ww .j  a va2 s  .  c o  m
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(SecurityImpl.class);
        if (pageNumber > 0 && pageSize > 0) {
            criteria.setFirstResult(this.calculateFirstResult(pageNumber, pageSize));
            criteria.setMaxResults(pageSize);
        }
        final Collection<?> results = criteria.list();
        this.transformEntities(transform, results);
        return results;
    } catch (HibernateException ex) {
        throw super.convertHibernateAccessException(ex);
    }
}