use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernateSectionStore method getSectionByName.
@Override
public Section getSectionByName(String name, DataSet dataSet) {
Criteria criteria = getCriteria();
criteria.add(Restrictions.eq("name", name));
criteria.add(Restrictions.eq("dataSet", dataSet));
return (Section) criteria.uniqueResult();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernateDataValueAuditStore method getDataValueAudits.
@Override
@SuppressWarnings("unchecked")
public List<DataValueAudit> getDataValueAudits(List<DataElement> dataElements, List<Period> periods, List<OrganisationUnit> organisationUnits, DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo, AuditType auditType, int first, int max) {
Criteria criteria = getDataValueAuditCriteria(dataElements, periods, organisationUnits, categoryOptionCombo, attributeOptionCombo, auditType);
criteria.addOrder(Order.desc("created"));
criteria.setFirstResult(first);
criteria.setMaxResults(max);
return criteria.list();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernateLockExceptionStore method getAllOrderedName.
@Override
@SuppressWarnings("unchecked")
public List<LockException> getAllOrderedName(int first, int max) {
Criteria criteria = getCriteria();
criteria.setFirstResult(first);
criteria.setMaxResults(max);
return criteria.list();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernatePeriodStore method getPeriodType.
@Override
public PeriodType getPeriodType(Class<? extends PeriodType> periodType) {
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria(periodType);
return (PeriodType) criteria.setCacheable(true).uniqueResult();
}
use of org.hibernate.Criteria in project dhis2-core by dhis2.
the class HibernatePeriodStore method getPeriod.
@Override
public Period getPeriod(Date startDate, Date endDate, PeriodType periodType) {
Criteria criteria = getCriteria();
criteria.add(Restrictions.eq("startDate", startDate));
criteria.add(Restrictions.eq("endDate", endDate));
criteria.add(Restrictions.eq("periodType", reloadPeriodType(periodType)));
return (Period) criteria.uniqueResult();
}
Aggregations