List of usage examples for org.hibernate Criteria list
public List list() throws HibernateException;
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public List<InvColRowType> getInvColRowTypes() { Criteria criteria = getSession().createCriteria(InvColRowType.class); List<InvColRowType> list = criteria.list(); return list;/* ww w .j a va2 s . c o m*/ }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvFreezer getInvFreezer(Long id) { InvFreezer invFreezer = new InvFreezer(); Criteria criteria = getSession().createCriteria(InvFreezer.class); if (id != null) { criteria.add(Restrictions.eq("id", id)); }/*from ww w . j a v a 2s.com*/ List<InvFreezer> list = criteria.list(); if (!list.isEmpty()) { invFreezer = (InvFreezer) list.get(0); } if (invFreezer == null) { log.error("InvFreezer with ID " + id + " is no longer in the database"); } return invFreezer; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvRack getInvRack(Long id) { InvRack invRack = new InvRack(); Criteria criteria = getSession().createCriteria(InvRack.class); if (id != null) { criteria.add(Restrictions.eq("id", id)); }// w ww .j a va2s. c om List<InvRack> list = criteria.list(); if (!list.isEmpty()) { invRack = (InvRack) list.get(0); } if (invRack == null) { log.error("InvRack with ID " + id + " is no longer in the database"); } return invRack; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvCell getInvCellByBiospecimen(Biospecimen biospecimen) { InvCell invCell = new InvCell(); Criteria criteria = getSession().createCriteria(InvCell.class); if (biospecimen != null) { criteria.add(Restrictions.eq("biospecimen", biospecimen)); }/*from ww w .j a v a 2s. c o m*/ List<InvCell> list = criteria.list(); if (!list.isEmpty()) { invCell = (InvCell) list.get(0); } if (invCell == null) { log.error("InvCell with biospecimen " + biospecimen.getId() + " is no longer in the database"); } return invCell; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvCell getInvCell(Long id) { InvCell invCell = new InvCell(); Criteria criteria = getSession().createCriteria(InvCell.class); if (id != null) { criteria.add(Restrictions.eq("id", id)); }/*from w w w .j a v a 2 s. co m*/ List<InvCell> list = criteria.list(); if (!list.isEmpty()) { invCell = (InvCell) list.get(0); } if (invCell == null) { log.error("InvRack with ID " + id + " is no longer in the database"); } return invCell; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public List<InvBox> searchInvBox(InvBox invBox) throws ArkSystemException { Criteria criteria = getSession().createCriteria(InvBox.class); if (invBox.getId() != null) { criteria.add(Restrictions.eq("id", invBox.getId())); }//w ww . j a va2s . c o m if (invBox.getName() != null) { criteria.add(Restrictions.eq("name", invBox.getName())); } List<InvBox> list = criteria.list(); return list; }
From source file:au.org.theark.lims.model.dao.InventoryDao.java
License:Open Source License
public InvCell getNextAvailableInvCell(InvBox invBox) { Criteria criteria = getSession().createCriteria(InvCell.class); criteria.add(Restrictions.eq("invBox", invBox)); criteria.add(Restrictions.isNull("biospecimen")); criteria.setMaxResults(1);/*from www . ja v a2s.c om*/ return (InvCell) criteria.list().get(0); }
From source file:au.org.theark.lims.model.dao.LimsSubjectDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<LinkSubjectStudy> searchPageableSubjects(LimsVO limsVoCriteria, List<Study> studyList, int first, int count) { Criteria criteria = buildGeneralSubjectCriteria(limsVoCriteria, studyList); criteria.setFirstResult(first);//from w w w .j a va 2s.co m criteria.setMaxResults(count); List<LinkSubjectStudy> subjectList = criteria.list(); return subjectList; }
From source file:au.org.theark.lims.model.dao.LimsSubjectDao.java
License:Open Source License
public SubjectStatus getSubjectStatus(String statusName) { SubjectStatus statusToReturn = null; SubjectStatus subjectStatus = new SubjectStatus(); subjectStatus.setName(statusName);//from w w w. j a va 2 s.co m Example example = Example.create(subjectStatus); Criteria criteria = getSession().createCriteria(SubjectStatus.class).add(example); if (criteria != null) { List<SubjectStatus> results = criteria.list(); if (results != null && !results.isEmpty()) { statusToReturn = (SubjectStatus) results.get(0); } } return statusToReturn; }
From source file:au.org.theark.lims.model.dao.LimsSubjectDao.java
License:Open Source License
public String getPreviousLastname(Person person) { Criteria criteria = getSession().createCriteria(PersonLastnameHistory.class); if (person.getId() != null) { criteria.add(Restrictions.eq(Constants.PERSON_SURNAME_HISTORY_PERSON, person)); }//from w w w. j a v a 2 s . c o m criteria.addOrder(Order.desc("id")); PersonLastnameHistory personLastameHistory = null; List<PersonLastnameHistory> results = criteria.list(); if (!results.isEmpty()) { personLastameHistory = (PersonLastnameHistory) results.get(1); } return personLastameHistory.getLastName(); }