List of usage examples for org.hibernate Criteria list
public List list() throws HibernateException;
From source file:au.org.theark.lims.model.dao.BioTransactionDao.java
License:Open Source License
public List<TreatmentType> getTreatmentTypes() { Criteria criteria = getSession().createCriteria(TreatmentType.class); List<TreatmentType> list = criteria.list(); return list;/* w ww .j a v a 2s.c om*/ }
From source file:au.org.theark.lims.model.dao.BioTransactionDao.java
License:Open Source License
public List<BioTransactionStatus> getBioTransactionStatusChoices() { Criteria criteria = getSession().createCriteria(BioTransactionStatus.class); // remove Initial Quantity status choice because this is reserved criteria.add(// ww w.ja v a2 s . co m Restrictions.ne("name", au.org.theark.lims.web.Constants.BIOTRANSACTION_STATUS_INITIAL_QUANTITY)); return criteria.list(); }
From source file:au.org.theark.lims.model.dao.BioTransactionDao.java
License:Open Source License
public List<AccessRequest> getAccessRequests() { Criteria criteria = getSession().createCriteria(AccessRequest.class); return criteria.list(); }
From source file:au.org.theark.lims.model.dao.BioTransactionDao.java
License:Open Source License
public List<BioTransaction> getAllBiotransactionForBiospecimen(Biospecimen biospecimen) { Criteria criteria = getSession().createCriteria(BioTransaction.class); criteria.add(Restrictions.eq("biospecimen", biospecimen)); List<BioTransaction> result = (List<BioTransaction>) criteria.list(); return result; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public List<InvSite> searchInvSite(InvSite invSite) throws ArkSystemException { Criteria criteria = getSession().createCriteria(InvSite.class); if (invSite.getId() != null) { criteria.add(Restrictions.eq("id", invSite.getId())); }// w ww . ja va2s .com if (invSite.getName() != null) { criteria.add(Restrictions.eq("name", invSite.getName())); } if (invSite.getContact() != null) { criteria.add(Restrictions.eq("contact", invSite.getContact())); } if (invSite.getAddress() != null) { criteria.add(Restrictions.eq("address", invSite.getAddress())); } if (invSite.getPhone() != null) { criteria.add(Restrictions.eq("phone", invSite.getPhone())); } List<InvSite> list = criteria.list(); return list; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public List<InvSite> searchInvSite(InvSite invSite, List<Study> studyList) throws ArkSystemException { List<InvSite> invSiteList = new ArrayList<InvSite>(0); if (studyList == null || studyList.isEmpty()) { return invSiteList; }/*from w w w . j a v a 2 s .c o m*/ Criteria criteria = getSession().createCriteria(StudyInvSite.class); /* * if (invSite.getId() != null) { criteria.add(Restrictions.eq("id", invSite.getId())); } * * if (invSite.getName() != null) { criteria.add(Restrictions.eq("name", invSite.getName())); } * * if (invSite.getContact() != null) { criteria.add(Restrictions.eq("contact", invSite.getContact())); } * * if (invSite.getAddress() != null) { criteria.add(Restrictions.eq("address", invSite.getAddress())); } * * if (invSite.getPhone() != null) { criteria.add(Restrictions.eq("phone", invSite.getPhone())); } */ /*if you have an empty grouping, hibernate will do this sort of this; * select this_.INV_SITE_ID as y0_ from lims.study_inv_site this_ where this_.STUDY_ID in ( ) group by this_.INV_SITE_ID ...therefore always null check before checking if something is in a group of nothing */ criteria.add(Restrictions.in("study", studyList)); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.groupProperty("invSite"), "invSite"); criteria.setProjection(projectionList); // List<StudyInvSite> list = criteria.list(); invSiteList = criteria.list(); /* * for(StudyInvSite studyInvSite : list){ invSiteList.add(studyInvSite.getInvSite()); } */ return invSiteList; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvSite getInvSite(Long id) { InvSite invSite = new InvSite(); Criteria criteria = getSession().createCriteria(InvSite.class); if (id != null) { criteria.add(Restrictions.eq("id", id)); }//from w w w .java 2s. c o m List<InvSite> list = criteria.list(); if (!list.isEmpty()) { invSite = (InvSite) list.get(0); } return invSite; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvCell getInvCell(InvBox invBox, long rowno, long colno) { InvCell invCell = null; //new InvCell(); Criteria criteria = getSession().createCriteria(InvCell.class); if (invBox != null) { criteria.add(Restrictions.eq("invBox", invBox)); }//from ww w . j ava2 s . c om criteria.add(Restrictions.eq("rowno", rowno)); criteria.add(Restrictions.eq("colno", colno)); List<InvCell> list = criteria.list(); if (!list.isEmpty()) { invCell = (InvCell) list.get(0); } return invCell; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public Biospecimen getBiospecimenByInvCell(InvCell invCell) { Biospecimen biospecimen = null;//from w ww . j ava 2 s . co m Criteria criteria = getSession().createCriteria(InvCell.class); criteria.add(Restrictions.eq("id", invCell.getId())); List<InvCell> list = criteria.list(); if (!list.isEmpty()) { biospecimen = (Biospecimen) list.get(0).getBiospecimen(); } return biospecimen; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvBox getInvBox(Long id) { InvBox invBox = new InvBox(); Criteria criteria = getSession().createCriteria(InvBox.class); if (id != null) { criteria.add(Restrictions.eq("id", id)); }/*from ww w . j a va2s . c om*/ List<InvBox> list = criteria.list(); if (!list.isEmpty()) { invBox = (InvBox) list.get(0); } if (invBox == null) { log.error("InvBox with ID " + id + " is no longer in the database"); } return invBox; }