List of usage examples for org.hibernate Criteria setResultTransformer
public Criteria setResultTransformer(ResultTransformer resultTransformer);
From source file:dao.hibernate.HibernateWorkDAO.java
@Override public List<Work> getUngradedWorks() throws EngineDAOException { getSession().beginTransaction();//from w w w. j a v a 2 s . c o m Criteria criteria = getSession().createCriteria(persistentClass); criteria.add(Restrictions.eq(GRADE, null)); criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); List<Work> works; try { works = criteria.list(); } catch (RuntimeException e) { throw new EngineDAOException(e); } if (works == null) { getSession().getTransaction().rollback(); throw new EngineDAOException( MessageFormat.format(ERROR_PERSON_NOT_FOUND_BY_USERNAME_AND_PASSWORD, null)); } getSession().getTransaction().commit(); return works; }
From source file:dao.hibernate.HibernateWorkDAO.java
@Override public Work getApprovedWorkByStudentWithoutFinalURI(Student student) throws EngineDAOException { getSession().beginTransaction();/*from ww w .j av a 2s.co m*/ Criteria criteria = getSession().createCriteria(persistentClass); criteria.add(Restrictions.isNull(FINAL_FILE_URI)); criteria.add(Restrictions.eq(STUDENT, student)); criteria.add(Restrictions.eq(STATUS, APPROVED)); criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); Work work; try { work = (Work) criteria.uniqueResult(); System.out.println(work); } catch (RuntimeException e) { throw new EngineDAOException(e); } if (work == null) { getSession().getTransaction().rollback(); throw new EngineDAOException( MessageFormat.format(ERROR_PERSON_NOT_FOUND_BY_USERNAME_AND_PASSWORD, null)); } getSession().getTransaction().commit(); return work; }
From source file:dao.ImagenDaoImpl.java
@Override public List<Imagen> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Imagen> imagen = (List<Imagen>) criteria.list(); return imagen; }
From source file:dao.InformacionDaoImpl.java
@Override public List<Informacion> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Informacion> matricula = (List<Informacion>) criteria.list(); return matricula; }
From source file:dao.InformacionKinderDaoImpl.java
@Override public List<InformacionKinder> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<InformacionKinder> contacto = (List<InformacionKinder>) criteria.list(); return contacto; }
From source file:dao.KinderDaoImpl.java
@Override public List<Kinder> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Kinder> kinder = (List<Kinder>) criteria.list(); return kinder; }
From source file:dao.MatriculaDaoImpl.java
@Override public List<Matricula> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Matricula> matricula = (List<Matricula>) criteria.list(); return matricula; }
From source file:dao.MensajeDaoImpl.java
@Override public List<Mensaje> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Mensaje> contacto = (List<Mensaje>) criteria.list(); return contacto; }
From source file:dao.MensajeKinderDaoImpl.java
@Override public List<MensajeKinder> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<MensajeKinder> contacto = (List<MensajeKinder>) criteria.list(); return contacto; }
From source file:dao.MesDaoImpl.java
@Override public List<Mes> findAll() { Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Mes> contacto = (List<Mes>) criteria.list(); return contacto; }