List of usage examples for org.hibernate Query setFetchSize
Query<R> setFetchSize(int fetchSize);
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified repository by publication date. * /* www.ja v a2 s . co m*/ * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param repositoryId - id of the collection to get items * @param orderType - The order to sort by (ascending/descending) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsPublicationDateOrder(int rowStart, int maxResults, Long repositoryId, OrderType orderType) { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getRepositoryItemsByPublicationDateOrderDesc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getRepositoryItemsByPublicationDateOrderAsc"); } q.setLong("repositoryId", repositoryId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setCacheable(false); q.setReadOnly(true); q.setFetchSize(maxResults); return (List<InstitutionalItem>) q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified repository by publication date. * // w w w. j a v a2 s. c o m * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param repositoryId - id of the collection to get items * @param contentTypeId - id of the content type * @param orderType - The order to sort by (ascending/descending) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsPublicationDateOrder(int rowStart, int maxResults, Long repositoryId, Long contentTypeId, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getRepositoryItemsContentTypeByPublicationDateOrderDesc"); } else { q = session.getNamedQuery("getRepositoryItemsContentTypeByPublicationDateOrderAsc"); } q.setParameter("repositoryId", repositoryId); q.setParameter("contentTypeId", contentTypeId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get the list of items for the specified collection with the given * content type id. This includes items in child collections * //from w w w. j ava 2 s. c o m * @param rowStart - Start row to fetch the data from * @param maxResults - maximum number of results to return * @param collection - the collection to get items * @param orderType - The order to sort by (ascending/descending) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsFirstAvailableOrder(int rowStart, int maxResults, InstitutionalCollection collection, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getInstitutionalCollectionItemsFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsFirstAvailableOrderAsc"); } q.setLong("leftVal", collection.getLeftValue()); q.setLong("rightVal", collection.getRightValue()); q.setLong("rootId", collection.getTreeRoot().getId()); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get the list of items for the specified collection with the given * content type id. This includes items in child collections * // w ww . jav a 2 s . c o m * @param rowStart - Start row to fetch the data from * @param maxResults - maximum number of results to return * @param collection - the collection to get items * @param contentTypeId - id of the content type * @param orderType - The order to sort by (ascending/descending) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsFirstAvailableOrder(int rowStart, int maxResults, InstitutionalCollection collection, Long contentTypeId, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getInstitutionalCollectionItemsContentTypeByFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsContentTypeByFirstAvailableOrderAsc"); } q.setLong("leftVal", collection.getLeftValue()); q.setLong("rightVal", collection.getRightValue()); q.setLong("rootId", collection.getTreeRoot().getId()); q.setLong("contentTypeId", contentTypeId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified repository by between the that have titles * that start between the specified characters * /*w w w. ja v a2 s .co m*/ * NOTE: This search includes all items in child collections * * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param collection - the institutional collection * @param firstChar - first character in range that the first letter of the name can have * @param lastChar - last character in range that the first letter of the name can have * @param orderType - The order to sort by (asc/desc) * * @return list of items matching the specified criteria * * @see edu.ur.ir.institution.InstitutionalItemDAO#getCollectionItemsBetweenChar(int, int, edu.ur.ir.institution.InstitutionalCollection, java.lang.Long, char, char, edu.ur.order.OrderType) */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsBetweenCharFirstAvailableOrder(int rowStart, int maxResults, InstitutionalCollection collection, char firstChar, char lastChar, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharRangeFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharRangeFirstAvailableOrderAsc"); } q.setParameter("leftVal", collection.getLeftValue()); q.setParameter("rightVal", collection.getRightValue()); q.setParameter("rootId", collection.getTreeRoot().getId()); q.setParameter("firstChar", Character.valueOf(Character.toLowerCase(firstChar))); q.setParameter("lastChar", Character.valueOf(Character.toLowerCase(lastChar))); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified repository by between the that have titles * that start between the specified characters * /*from w w w.j a v a2 s .co m*/ * NOTE: This search includes all items in child collections * * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param collection - the institutional collection * @param contentTypeId - id of the content type * @param firstChar - first character in range that the first letter of the name can have * @param lastChar - last character in range that the first letter of the name can have * @param orderType - The order to sort by (asc/desc) * * @return list of items matching the specified criteria * * @see edu.ur.ir.institution.InstitutionalItemDAO#getCollectionItemsBetweenChar(int, int, edu.ur.ir.institution.InstitutionalCollection, java.lang.Long, char, char, edu.ur.order.OrderType) */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsBetweenCharFirstAvailableOrder(int rowStart, int maxResults, InstitutionalCollection collection, Long contentTypeId, char firstChar, char lastChar, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session .getNamedQuery("getInstitutionalCollectionItemsContentTypeByCharRangeFirstAvailableOrderDesc"); } else { q = session .getNamedQuery("getInstitutionalCollectionItemsContentTypeByCharRangeFirstAvailableOrderAsc"); } q.setParameter("leftVal", collection.getLeftValue()); q.setParameter("rightVal", collection.getRightValue()); q.setParameter("rootId", collection.getTreeRoot().getId()); q.setParameter("firstChar", Character.valueOf(Character.toLowerCase(firstChar))); q.setParameter("lastChar", Character.valueOf(Character.toLowerCase(lastChar))); q.setParameter("contentTypeId", contentTypeId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified collection by first character of the name * //from w w w . j a va2s. c o m * NOTE: This search includes all items in child collections * * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param institutional collection - the institutional collection * @param firstChar - first character that the name should have * @param orderType - The order to sort by (asc/desc) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsByCharFirstAvailableOrder(int rowStart, int maxResults, InstitutionalCollection collection, char firstChar, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharFirstAvailableOrderAsc"); } q.setParameter("leftVal", collection.getLeftValue()); q.setParameter("rightVal", collection.getRightValue()); q.setParameter("rootId", collection.getTreeRoot().getId()); q.setParameter("firstChar", Character.valueOf(Character.toLowerCase(firstChar))); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified collection by first character of the name * //ww w . j a v a 2 s. c o m * NOTE: This search includes all items in child collections * * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param institutional collection - the institutional collection * @param contentTypeId - id of the content type * @param firstChar - first character that the name should have * @param orderType - The order to sort by (asc/desc) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsByCharFirstAvailableOrder(int rowStart, int maxResults, InstitutionalCollection collection, Long contentTypeId, char firstChar, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getInstitutionalCollectionItemsContentTypeByCharFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsContentTypeByCharFirstAvailableOrderAsc"); } q.setParameter("leftVal", collection.getLeftValue()); q.setParameter("rightVal", collection.getRightValue()); q.setParameter("rootId", collection.getTreeRoot().getId()); q.setParameter("firstChar", Character.valueOf(Character.toLowerCase(firstChar))); q.setParameter("contentTypeId", contentTypeId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified repository by publication date. * /* w w w .jav a 2 s .c o m*/ * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param repositoryId - id of the collection to get items * @param contentTypeId - id of the content type * @param orderType - The order to sort by (ascending/descending) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsFirstAvailableOrder(int rowStart, int maxResults, Long repositoryId, Long contentTypeId, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getRepositoryItemsContentTypeByFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getRepositoryItemsContentTypeByFirstAvailableOrderAsc"); } q.setParameter("repositoryId", repositoryId); q.setParameter("contentTypeId", contentTypeId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * Get a list of items for a specified repository by publication date. * // w ww . j a va 2 s .c o m * @param rowStart - Start row to fetch the data from * @param maxResulsts - maximum number of results to fetch * @param repositoryId - id of the collection to get items * @param orderType - The order to sort by (ascending/descending) * * @return List of institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsFirstAvailableOrder(int rowStart, int maxResults, Long repositoryId, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getRepositoryItemsByFirstAvailableOrderDesc"); } else { q = session.getNamedQuery("getRepositoryItemsByFirstAvailableOrderAsc"); } q.setParameter("repositoryId", repositoryId); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }