Example usage for org.hibernate Criteria setFirstResult

List of usage examples for org.hibernate Criteria setFirstResult

Introduction

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

Prototype

public Criteria setFirstResult(int firstResult);

Source Link

Document

Set the first result to be retrieved.

Usage

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

/**
 * {@inheritDoc}/*ww  w. j a va2 s  .  com*/
 */
@Override
public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize) {
    try {
        final Criteria criteria = this.getSession(false).createCriteria(BarImpl.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.GenericMarketDataEventDaoBase.java

/**
 * {@inheritDoc}/*  w w w  . ja v 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(GenericMarketDataEventImpl.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.MarketDataEventDaoBase.java

/**
 * {@inheritDoc}/*from w w w  .j  a 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(MarketDataEventImpl.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.MarketDataEventDefinitionDaoBase.java

/**
 * {@inheritDoc}//from   w  ww .  j a  v a  2  s  .com
 */
@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}//w ww .  j  a va  2s  .  c om
 */
@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 ww.ja 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(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 . jav  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}//  ww w  .  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(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}// w  w w . j a va2s . c  o  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}/*ww w .  j av a2 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(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);
    }
}