List of usage examples for org.hibernate Criteria setMaxResults
public Criteria setMaxResults(int maxResults);
From source file:au.org.theark.core.dao.ArkAuthorisationDao.java
License:Open Source License
public ArkModule getArkModuleById(Long moduleId) { Criteria criteria = getSession().createCriteria(ArkModule.class); criteria.add(Restrictions.eq("id", moduleId)); criteria.setMaxResults(1); ArkModule arkModule = (ArkModule) criteria.uniqueResult(); return arkModule; }
From source file:au.org.theark.core.dao.StudyDao.java
License:Open Source License
public List<SubjectVO> searchPageableSubjects(SubjectVO subjectVoCriteria, int first, int count) { Criteria criteria = buildGeneralSubjectCriteria(subjectVoCriteria); criteria.setFirstResult(first);/*from w ww . j a v a 2s . com*/ criteria.setMaxResults(count); List<Long> longs = criteria.list(); List<LinkSubjectStudy> list = new ArrayList<LinkSubjectStudy>();//criteria.list(); for (Long l : longs) { try { list.add(getLinkSubjectStudy(l)); } catch (EntityNotFoundException e) { e.printStackTrace(); } } List<SubjectVO> subjectVOList = new ArrayList<SubjectVO>(); // TODO analyse for (Iterator iterator = list.iterator(); iterator.hasNext();) { LinkSubjectStudy linkSubjectStudy = (LinkSubjectStudy) iterator.next(); // Place the LinkSubjectStudy instance into a SubjectVO and add the // SubjectVO into a List SubjectVO subject = new SubjectVO(); subject.setLinkSubjectStudy(linkSubjectStudy); // Person person = subject.getLinkSubjectStudy().getPerson(); subject.setSubjectUID(linkSubjectStudy.getSubjectUID()); subjectVOList.add(subject); } return subjectVOList; }
From source file:au.org.theark.core.dao.StudyDao.java
License:Open Source License
public ArkFunctionType getArkFunctionType(String reportType) { Criteria criteria = getSession().createCriteria(ArkFunctionType.class); criteria.add(Restrictions.eq("name", reportType)); criteria.setMaxResults(1); return (ArkFunctionType) criteria.uniqueResult(); }
From source file:au.org.theark.core.dao.StudyDao.java
License:Open Source License
public List<OtherID> getOtherIDs(Person person) { if (person != null) { Criteria c = getSession().createCriteria(OtherID.class); c.setMaxResults(100); c.add(Restrictions.eq("person", person)); List<OtherID> results = c.list(); return results; } else {/*from ww w . ja v a 2 s . c o m*/ return new ArrayList<OtherID>(); } }
From source file:au.org.theark.core.dao.StudyDao.java
License:Open Source License
public Collection<PersonLastnameHistory> getPersonLastnameHistory(Person person) { Criteria c = getSession().createCriteria(PersonLastnameHistory.class); c.setMaxResults(100); c.add(Restrictions.eq("person", person)); Collection<PersonLastnameHistory> results = c.list(); return results; }
From source file:au.org.theark.lims.model.dao.BioCollectionDao.java
License:Open Source License
public List<BioCollection> searchPageableBioCollections(BioCollection bioCollectionCriteria, int first, int count) { Criteria criteria = buildBioCollectionCriteria(bioCollectionCriteria); criteria.setFirstResult(first);//from w w w .ja v a 2s . c o m criteria.setMaxResults(count); List<BioCollection> list = criteria.list(); return list; }
From source file:au.org.theark.lims.model.dao.BiospecimenDao.java
License:Open Source License
public List<Biospecimen> searchPageableBiospecimens(Biospecimen biospecimenCriteria, int first, int count) { Criteria criteria = buildBiospecimenCriteria(biospecimenCriteria); criteria.setFirstResult(first);/*from w w w . j av a 2 s. co m*/ criteria.setMaxResults(count); criteria.addOrder(Order.asc("id")); List<Biospecimen> list = criteria.list(); return list; }
From source file:au.org.theark.lims.model.dao.BiospecimenDao.java
License:Open Source License
public List<Biospecimen> searchPageableBiospecimens(LimsVO limsVo, int first, int count) { Criteria criteria = buildBiospecimenCriteria(limsVo); criteria.setFirstResult(first);// w w w .j a v a2s.c o m criteria.setMaxResults(count); List<Biospecimen> list = criteria.list(); return list; }
From source file:au.org.theark.lims.model.dao.BiospecimenDao.java
License:Open Source License
protected BiospecimenUidSequence getBiospecimenUidSequence(Study study) { // Stateless sessions should be used to avoid locking the record for future update // by getSession(), which relies on the "open session filter" mechanism StatelessSession session = getStatelessSession(); Criteria criteria = session.createCriteria(BiospecimenUidSequence.class); criteria.add(Restrictions.eq(Constants.SUBJECTUIDSEQ_STUDYNAMEID, study.getName())); criteria.setMaxResults(1); BiospecimenUidSequence result = (BiospecimenUidSequence) criteria.uniqueResult(); session.close();//from ww w.j a v a 2 s. c o m return result; }
From source file:au.org.theark.lims.model.dao.BioTransactionDao.java
License:Open Source License
public List<BioTransaction> searchPageableBioTransactions(BioTransaction bioTransaction, int first, int count) { // Handle for biospecimen not in context if (bioTransaction.getBiospecimen() == null) { return new ArrayList<BioTransaction>(0); }// w ww . j a va 2s .c o m Criteria criteria = buildBioTransactionCriteria(bioTransaction); // sort by most recent first criteria.addOrder(Order.desc("transactionDate")); criteria.addOrder(Order.desc("id")); // support pageable results list criteria.setFirstResult(first); criteria.setMaxResults(count); List<BioTransaction> list = criteria.list(); return list; }