List of usage examples for org.hibernate Criteria uniqueResult
public Object uniqueResult() throws HibernateException;
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvFreezer getFreezerByNameForSite(InvSite invSite, String freezerName) { Criteria criteria = getSession().createCriteria(InvFreezer.class); if (invSite != null) { criteria.add(Restrictions.eq("invSite", invSite)); }/* w w w.j av a 2 s . co m*/ if (freezerName != null && !freezerName.isEmpty()) { criteria.add(Restrictions.eq("name", freezerName)); } return (InvFreezer) criteria.uniqueResult(); }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvRack getRackByNameForFreezer(InvFreezer invFreezer, String rackName) { Criteria criteria = getSession().createCriteria(InvRack.class); if (invFreezer != null) { criteria.add(Restrictions.eq("invFreezer", invFreezer)); }//ww w. jav a 2 s. c o m if (rackName != null && !rackName.isEmpty()) { criteria.add(Restrictions.eq("name", rackName)); } return (InvRack) criteria.uniqueResult(); }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
/** * /* w w w . j av a 2 s . c om*/ */ public InvBox getBoxByNameForRack(InvRack invRack, String boxName) { Criteria criteria = getSession().createCriteria(InvBox.class); if (invRack != null) { criteria.add(Restrictions.eq("invRack", invRack)); } if (boxName != null && !boxName.isEmpty()) { criteria.add(Restrictions.eq("name", boxName)); } return (InvBox) criteria.uniqueResult(); }
From source file:au.org.theark.lims.model.dao.LimsSubjectDao.java
License:Open Source License
public long getSubjectCount(LimsVO limsVo, List<Study> studyList) { if (studyList != null && !studyList.isEmpty()) { Criteria criteria = buildGeneralSubjectCriteria(limsVo, studyList); criteria.setProjection(Projections.rowCount()); Long totalCount = (Long) criteria.uniqueResult(); return totalCount.intValue(); } else {/* w ww. ja v a 2 s . c om*/ // Fixes to handle for if the studyList is empty (i.e. don't bother querying the database) return 0; } }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public long getPhenoDataCount(PhenoDataSetCollection phenoCollection, PhenoDataSetCategory phenoDataSetCategory) { Criteria criteria = getSession().createCriteria(PhenoDataSetFieldDisplay.class); criteria.createAlias("phenoDataSetGroup", "qnaire"); if (phenoCollection.getQuestionnaire() != null) { criteria.add(Restrictions.eq("qnaire.id", phenoCollection.getQuestionnaire().getId())); }//from w w w. j a va2s . c o m criteria.setProjection(Projections.rowCount()); Long count = (Long) criteria.uniqueResult(); return count.intValue(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public long getPhenoCollectionCount(PhenoDataCollectionVO collectionCriteria) { Criteria criteria = getSession().createCriteria(PhenoDataSetCollection.class); criteria.createAlias("questionnaire", "qnaire"); criteria.add(Restrictions.eq("linkSubjectStudy", collectionCriteria.getPhenoDataSetCollection().getLinkSubjectStudy())); // Just a precaution (PhenoCollection to should always map to a CustomFieldGroup where the ArkFunction will correspond to Pheno) //criteria.add(Restrictions.eq("qnaire.arkFunction", collectionCriteria.getArkFunction())); criteria.setProjection(Projections.rowCount()); Long count = (Long) criteria.uniqueResult(); return count; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public long getCFDLinkedToQuestionnaireCount(PhenoDataSetGroup phenoDataSetGroup) { Criteria criteria = getSession().createCriteria(PhenoDataSetFieldDisplay.class); criteria.add(Restrictions.eq("phenoDataSetGroup", phenoDataSetGroup)); criteria.setProjection(Projections.rowCount()); return (Long) criteria.uniqueResult(); }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public QuestionnaireStatus getPhenoCollectionStatusByName(String statusName) { Criteria criteria = getSession().createCriteria(QuestionnaireStatus.class); criteria.add(Restrictions.eq("name", statusName).ignoreCase()); QuestionnaireStatus result = (QuestionnaireStatus) criteria.uniqueResult(); return result; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
public CustomFieldGroup getCustomFieldGroupByNameAndStudy(String name, Study study) { Criteria criteria = getSession().createCriteria(CustomFieldGroup.class); criteria.add(Restrictions.eq("name", name)); criteria.add(Restrictions.eq("study", study)); CustomFieldGroup result = null;//from w w w. j a v a2 s . c om result = (CustomFieldGroup) criteria.uniqueResult(); return result; }
From source file:au.org.theark.phenotypic.model.dao.PhenotypicDao.java
License:Open Source License
@Override public PhenoDataSetCategory getPhenoDataSetCategory(Long id) { Criteria criteria = getSession().createCriteria(PhenoDataSetCategory.class); criteria.add(Restrictions.eq("id", id)); criteria.setMaxResults(1);/* w ww . j av a2 s .c o m*/ return (PhenoDataSetCategory) criteria.uniqueResult(); }