List of usage examples for org.hibernate Query setCharacter
@Deprecated @SuppressWarnings("unchecked") default Query<R> setCharacter(String name, char val)
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. ja v 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 repository to get items * @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 institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsBetweenChar(final int rowStart, final int maxResults, final Long repositoryId, final char firstChar, final char lastChar, final OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getRepositoryItemsByCharRangeOrderDesc"); } else { q = session.getNamedQuery("getRepositoryItemsByCharRangeOrderAsc"); } q.setLong("repositoryId", repositoryId); q.setCharacter("firstChar", Character.toLowerCase(firstChar)); q.setCharacter("lastChar", 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
/** * @see edu.ur.ir.institution.InstitutionalItemDAO#getCollectionItemsBetweenChar(int, int, edu.ur.ir.institution.InstitutionalCollection, char, char, java.lang.String) *///from www.j a v a2 s.com @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsBetweenChar(final int rowStart, final int maxResults, final InstitutionalCollection collection, final char firstChar, final char lastChar, final OrderType orderType) { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getCollectionItemsByCharRangeOrderDesc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getCollectionItemsByCharRangeOrderAsc"); } q.setLong("leftVal", collection.getLeftValue()); q.setLong("rightVal", collection.getRightValue()); q.setLong("rootId", collection.getTreeRoot().getId()); q.setCharacter("firstChar", Character.toLowerCase(firstChar)); q.setCharacter("lastChar", 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
/** * /*from w w w.j a va2 s .c o m*/ * @see edu.ur.ir.institution.InstitutionalItemDAO#getCollectionItemsByChar(int, int, edu.ur.ir.institution.InstitutionalCollection, char, java.lang.String) */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getCollectionItemsByChar(final int rowStart, final int maxResults, final InstitutionalCollection collection, final char firstChar, final OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharOrderAsc"); } q.setLong("leftVal", collection.getLeftValue()); q.setLong("rightVal", collection.getRightValue()); q.setLong("rootId", collection.getTreeRoot().getId()); q.setCharacter("firstChar", 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 repository by between the that have titles * that start between the specified characters * /*from w ww . j a va2s .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> getCollectionItemsBetweenCharPublicationDateOrder(int rowStart, int maxResults, InstitutionalCollection collection, char firstChar, char lastChar, OrderType orderType) { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getInstitutionalCollectionItemsByCharRangePublicationDateOrderDesc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getInstitutionalCollectionItemsByCharRangePublicationDateOrderAsc"); } q.setLong("leftVal", collection.getLeftValue()); q.setLong("rightVal", collection.getRightValue()); q.setLong("rootId", collection.getTreeRoot().getId()); q.setCharacter("firstChar", Character.toLowerCase(firstChar)); q.setCharacter("lastChar", 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 collection by first character of the name * // w w 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 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> getCollectionItemsByCharPublicationDateOrder(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("getInstitutionalCollectionItemsByCharPublicationDateOrderDesc"); } else { q = session.getNamedQuery("getInstitutionalCollectionItemsByCharPublicationDateOrderAsc"); } q.setLong("leftVal", collection.getLeftValue()); q.setLong("rightVal", collection.getRightValue()); q.setLong("rootId", collection.getTreeRoot().getId()); q.setCharacter("firstChar", 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 repository by between the that have titles * that start between the specified characters * //from ww 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 repository to get items * @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 institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsBetweenCharPublicationDateOrder(int rowStart, int maxResults, Long repositoryId, char firstChar, char lastChar, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getRepositoryItemsByCharRangePublicationDateOrderDesc"); } else { q = session.getNamedQuery("getRepositoryItemsByCharRangePublicationDateOrderAsc"); } q.setLong("repositoryId", repositoryId); q.setCharacter("firstChar", Character.toLowerCase(firstChar)); q.setCharacter("lastChar", 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 ww w .java 2 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 repository to get items * @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 institutional items */ @SuppressWarnings("unchecked") public List<InstitutionalItem> getRepositoryItemsByCharPublicationDateOrder(int rowStart, int maxResults, Long repositoryId, char firstChar, OrderType orderType) { Session session = hbCrudDAO.getSessionFactory().getCurrentSession(); Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getRepositoryItemsByCharPublicationDateOrderDesc"); } else { q = session.getNamedQuery("getRepositoryItemsByCharPublicationDateOrderAsc"); } q.setLong("repositoryId", repositoryId); q.setCharacter("firstChar", Character.toLowerCase(firstChar)); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); }
From source file:edu.ur.hibernate.ir.item.db.HbSponsorDAO.java
License:Apache License
/** * //from w w w . ja v a 2 s .com * @see edu.ur.ir.item.SponsorDAO#getByNameFirstChar(int, int, char, edu.ur.order.OrderType) */ @SuppressWarnings("unchecked") public List<Sponsor> getByNameFirstChar(final int rowStart, final int maxResults, final char firstChar, final OrderType orderType) { List<Sponsor> sponsors = (List<Sponsor>) hbCrudDAO.getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (orderType.equals(OrderType.ASCENDING_ORDER)) { q = session.getNamedQuery("getSponsorsOrderByNameFirstCharAsc"); } else { q = session.getNamedQuery("getSponsorsOrderByNameFirstCharDesc"); } q.setCharacter("sponsorFirstChar", Character.toLowerCase(firstChar)); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setReadOnly(true); q.setFetchSize(maxResults); return q.list(); } }); return sponsors; }
From source file:edu.ur.hibernate.ir.item.db.HbSponsorDAO.java
License:Apache License
/** * /* w w w . j a va 2 s . c o m*/ * @see edu.ur.ir.item.SponsorDAO#getSponsorsByNameBetweenChar(int, int, char, char, edu.ur.order.OrderType) */ @SuppressWarnings("unchecked") public List<Sponsor> getSponsorsByNameBetweenChar(final int rowStart, final int maxResults, final char firstChar, final char lastChar, final OrderType orderType) { List<Sponsor> sponsors = (List<Sponsor>) hbCrudDAO.getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (orderType.equals(OrderType.ASCENDING_ORDER)) { q = session.getNamedQuery("getSponsorsOrderByNameFirstCharRangeAsc"); } else { q = session.getNamedQuery("getSponsorsOrderByNameFirstCharRangeDesc"); } q.setCharacter("firstChar", Character.toLowerCase(firstChar)); q.setCharacter("secondChar", Character.toLowerCase(lastChar)); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setReadOnly(true); q.setFetchSize(maxResults); return q.list(); } }); return sponsors; }
From source file:edu.ur.hibernate.ir.item.db.HbSponsorDAO.java
License:Apache License
/** * /*from ww w. j ava 2 s. c o m*/ * @see edu.ur.ir.item.SponsorDAO#getCollectionSponsorsBetweenChar(int, int, edu.ur.ir.institution.InstitutionalCollection, char, char, edu.ur.order.OrderType) */ @SuppressWarnings("unchecked") public List<Sponsor> getCollectionSponsorsBetweenChar(final int rowStart, final int maxResults, final InstitutionalCollection collection, final char firstChar, final char lastChar, final OrderType orderType) { List<Sponsor> sponsors = (List<Sponsor>) hbCrudDAO.getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = session.getNamedQuery("getCollectionSponsorNameByCharRangeOrderDesc"); } else { q = session.getNamedQuery("getCollectionSponsorNameByCharRangeOrderAsc"); } q.setLong(0, collection.getLeftValue()); q.setLong(1, collection.getRightValue()); q.setLong(2, collection.getTreeRoot().getId()); q.setCharacter(3, Character.toLowerCase(firstChar)); q.setCharacter(4, Character.toLowerCase(lastChar)); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return q.list(); } }); return sponsors; }