List of usage examples for org.hibernate Query setReadOnly
Query<R> setReadOnly(boolean readOnly);
From source file:edu.ur.hibernate.ir.person.db.HbContributorTypeDAO.java
License:Apache License
@SuppressWarnings("unchecked") public List<ContributorType> getContributorTypes(final int rowStart, final int numberOfResultsToShow, final String sortType) { List<ContributorType> contributorTypes = (List<ContributorType>) hbCrudDAO.getHibernateTemplate() .execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (sortType.equalsIgnoreCase("asc")) { q = session.getNamedQuery("getContributorTypesOrderByNameAsc"); } else { q = session.getNamedQuery("getContributorTypesOrderByNameDesc"); }/*from ww w .ja va 2s. com*/ q.setFirstResult(rowStart); q.setMaxResults(numberOfResultsToShow); q.setReadOnly(true); q.setFetchSize(numberOfResultsToShow); return q.list(); } }); return contributorTypes; }
From source file:edu.ur.hibernate.ir.researcher.db.HbFieldDAO.java
License:Apache License
@SuppressWarnings("unchecked") public List<Field> getFields(final int rowStart, final int numberOfResultsToShow, final String sortType) { Query q = null; if (sortType.equalsIgnoreCase("asc")) { q = hbCrudDAO.getSessionFactory().getCurrentSession().getNamedQuery("getFieldsOrderByNameAsc"); } else {/*from w w w . j a v a 2 s .c om*/ q = hbCrudDAO.getSessionFactory().getCurrentSession().getNamedQuery("getFieldsOrderByNameDesc"); } q.setFirstResult(rowStart); q.setMaxResults(numberOfResultsToShow); q.setReadOnly(true); q.setFetchSize(numberOfResultsToShow); return q.list(); }
From source file:edu.ur.hibernate.ir.researcher.db.HbResearcherDAO.java
License:Apache License
/** * This will return all researchers including those who have set their researcher pages to private. * // w ww .j a v a2 s. c o m * Get researchers starting from the specified row and end at specified row. * The rows will be sorted by the specified parameter in given order. * * @return List of researchers */ @SuppressWarnings("unchecked") public List<Researcher> getResearchersByLastFirstName(final int rowStart, final int maxResults, final OrderType orderType) { log.debug("order type = " + orderType); Query q = null; if (orderType.equals(OrderType.ASCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getAllResearcherByLastFirstNameAsc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getAllResearcherByLastFirstNameDesc"); } q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setReadOnly(true); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.researcher.db.HbResearcherDAO.java
License:Apache License
/** * This returns only researchers who have set their page to public. * /*from w ww . ja v a 2 s .c om*/ * Get researchers starting from the specified row and end at specified row. * The rows will be sorted by the specified parameter in given order. * * @return List of researchers */ @SuppressWarnings("unchecked") public List<Researcher> getPublicResearchersByLastFirstName(final int rowStart, final int maxResults, final OrderType orderType) { Query q = null; if (orderType.equals(OrderType.ASCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getAllPublicResearcherByLastFirstNameAsc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getAllPublicResearcherByLastFirstNameDesc"); } q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setReadOnly(true); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.statistics.db.HbFileDownloadInfoDAO.java
License:Apache License
/** * This retrieves all file download info objects that are currently in the ignore * ip ranges./*ww w .j av a2 s.c o m*/ * * @return the list of file download info objects that are ignored. * @see edu.ur.ir.statistics.FileDownloadInfoDAO#getAllDownloadInfoIgnored() */ @SuppressWarnings("unchecked") public List<FileDownloadInfo> getDownloadInfoIgnored(final int rowStart, final int maxResults) { List<FileDownloadInfo> foundItems = (List<FileDownloadInfo>) hbCrudDAO.getHibernateTemplate() .execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.getNamedQuery("getFileDownloadsIgnored"); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setCacheable(false); q.setReadOnly(true); q.setFetchSize(maxResults); return q.list(); } }); return foundItems; }
From source file:edu.ur.hibernate.ir.statistics.db.HbFileDownloadRollUpProcessingRecordDAO.java
License:Apache License
@SuppressWarnings("unchecked") public List<FileDownloadRollUpProcessingRecord> getProcessingRecords(final int start, final int maxResults) { return (List<FileDownloadRollUpProcessingRecord>) hbCrudDAO.getHibernateTemplate() .execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.getNamedQuery("getAllFileDownloadRollUpProcessingRecords"); q.setReadOnly(true); q.setCacheable(false); q.setFirstResult(start); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return (List<FileDownloadRollUpProcessingRecord>) q.list(); }/*from ww w . j a v a 2s . co m*/ }); }
From source file:edu.ur.hibernate.ir.statistics.db.HbIgnoreIpAddressDAO.java
License:Apache License
/** * Get the Ignore IpAddresses based on the criteria. * /*from w w w . j av a2s. com*/ * @see edu.ur.ir.statistics.IgnoreIpAddressDAO#getIgnoreIpAddresses(int, int, String) */ @SuppressWarnings("unchecked") public List<IgnoreIpAddress> getIgnoreIpAddresses(final int rowStart, final int numberOfResultsToShow, final String sortType) { List<IgnoreIpAddress> ipAddresses = (List<IgnoreIpAddress>) hbCrudDAO.getHibernateTemplate() .execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (sortType.equalsIgnoreCase("asc")) { q = session.getNamedQuery("getIgnoreIPOrderByNameAsc"); } else { q = session.getNamedQuery("getIgnoreIPOrderByNameDesc"); } q.setFirstResult(rowStart); q.setMaxResults(numberOfResultsToShow); q.setReadOnly(true); q.setFetchSize(numberOfResultsToShow); return q.list(); } }); return ipAddresses; }
From source file:edu.ur.hibernate.ir.statistics.db.HbIpIgnoreFileDownloadInfoDAO.java
License:Apache License
@SuppressWarnings("unchecked") public List<IpIgnoreFileDownloadInfo> getIgnoreInfoNowAcceptable(final int rowStart, final int maxResults) { List<IpIgnoreFileDownloadInfo> foundItems = (List<IpIgnoreFileDownloadInfo>) hbCrudDAO .getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.getNamedQuery("getAcceptableFileDownloadsIgnored"); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setCacheable(false); q.setReadOnly(true); q.setFetchSize(maxResults); return q.list(); }// w w w. ja va 2s .com }); return foundItems; }
From source file:edu.ur.hibernate.ir.user.db.HbAffiliationDAO.java
License:Apache License
@SuppressWarnings("unchecked") public List<Affiliation> getAffiliations(final int rowStart, final int numberOfResultsToShow, final String sortType) { List<Affiliation> affiliations = (List<Affiliation>) hbCrudDAO.getHibernateTemplate() .execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (sortType.equalsIgnoreCase("asc")) { q = session.getNamedQuery("getAffiliationsOrderByNameAsc"); } else { q = session.getNamedQuery("getAffiliationsOrderByNameDesc"); }/*w w w . j av a 2 s . com*/ q.setFirstResult(rowStart); q.setMaxResults(numberOfResultsToShow); q.setReadOnly(true); q.setFetchSize(numberOfResultsToShow); return q.list(); } }); return affiliations; }
From source file:edu.ur.hibernate.ir.user.db.HbDepartmentDAO.java
License:Apache License
@SuppressWarnings("unchecked") public List<Department> getDepartments(final int rowStart, final int numberOfResultsToShow, final String sortType) { List<Department> departments = (List<Department>) hbCrudDAO.getHibernateTemplate() .execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (sortType.equalsIgnoreCase("asc")) { q = session.getNamedQuery("getDepartmentsOrderByNameAsc"); } else { q = session.getNamedQuery("getDepartmentsOrderByNameDesc"); }//www. ja v a2s . com q.setFirstResult(rowStart); q.setMaxResults(numberOfResultsToShow); q.setReadOnly(true); q.setFetchSize(numberOfResultsToShow); return q.list(); } }); return departments; }