List of usage examples for org.hibernate.annotations QueryHints FETCH_SIZE
String FETCH_SIZE
To view the source code for org.hibernate.annotations QueryHints FETCH_SIZE.
Click Source Link
From source file:org.dcm4chee.arc.qmgt.impl.QueueManagerEJB.java
License:LGPL
private Iterator<QueueMessage> listQueueMessages(TaskQueryParam queueTaskQueryParam, int fetchSize, int offset, int limit) { CriteriaBuilder cb = em.getCriteriaBuilder(); MatchTask matchTask = new MatchTask(cb); TypedQuery<QueueMessage> query = em.createQuery(select(cb, matchTask, queueTaskQueryParam)); if (fetchSize > 0) query.setHint(QueryHints.FETCH_SIZE, fetchSize); if (offset > 0) query.setFirstResult(offset);// w ww . j a v a 2s . c om if (limit > 0) query.setMaxResults(limit); return query.getResultStream().iterator(); }