List of usage examples for org.hibernate.criterion ProjectionList add
public ProjectionList add(Projection projection, String alias)
From source file:au.org.theark.study.model.dao.StudyDao.java
License:Open Source License
public List<RelationshipVo> getSubjectParentRelatives(final String subjectUID, final Long studyId) { List<RelationshipVo> relatives = new ArrayList<RelationshipVo>(); Criteria criteria = getSession().createCriteria(LinkSubjectPedigree.class, "lsp"); criteria.createAlias("subject", "sub", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("sub.study", "substudy", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relative", "rel", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("rel.study", "relstudy", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relationship", "type", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("rel.person", "relPerson", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relPerson.genderType", "relGender", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relPerson.vitalStatus", "relVitStatus", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relstudy.pedigreeConfiguration", "spc", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("spc.customField", "cf", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("cf.customFieldDisplay", "cfd", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("rel.subjectCustomFieldDataSet", "scfd", JoinType.LEFT_OUTER_JOIN, Restrictions.eqProperty("cfd.id", "scfd.customFieldDisplay.id")); criteria.add(Restrictions.eq("sub.subjectUID", subjectUID)); criteria.add(Restrictions.eq("substudy.id", studyId)); criteria.add(Restrictions.eq("relstudy.id", studyId)); criteria.setFetchMode("subject", FetchMode.JOIN); criteria.setFetchMode("relative", FetchMode.JOIN); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("lsp.id"), "id"); projectionList.add(Projections.property("rel.subjectUID"), "individualId"); projectionList.add(Projections.property("relGender.name"), "gender"); projectionList.add(Projections.property("relPerson.dateOfBirth"), "dob"); projectionList.add(Projections.property("relPerson.dateOfDeath"), "dod"); projectionList.add(Projections.property("relPerson.firstName"), "firstName"); projectionList.add(Projections.property("relPerson.lastName"), "lastName"); projectionList.add(Projections.property("relVitStatus.name"), "deceased"); projectionList.add(Projections.property("scfd.textDataValue"), "affectedStatus"); criteria.setProjection(projectionList); criteria.setResultTransformer(Transformers.aliasToBean(RelationshipVo.class)); relatives = criteria.list();//from w w w. j a va2s . co m return relatives; }
From source file:au.org.theark.study.model.dao.StudyDao.java
License:Open Source License
public List<RelationshipVo> getSubjectChildRelatives(final String subjectUID, final Long studyId) { List<RelationshipVo> relatives = new ArrayList<RelationshipVo>(); Criteria criteria = getSession().createCriteria(LinkSubjectPedigree.class, "lsp"); criteria.createAlias("subject", "sub", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("sub.study", "substudy", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relative", "rel", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("rel.study", "relstudy", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("relationship", "type", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("sub.person", "subPerson", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("subPerson.genderType", "subGender", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("subPerson.vitalStatus", "subVitStatus", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("substudy.pedigreeConfiguration", "spc", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("spc.customField", "cf", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("cf.customFieldDisplay", "cfd", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("sub.subjectCustomFieldDataSet", "scfd", JoinType.LEFT_OUTER_JOIN, Restrictions.eqProperty("cfd.id", "scfd.customFieldDisplay.id")); criteria.add(Restrictions.eq("rel.subjectUID", subjectUID)); criteria.add(Restrictions.eq("substudy.id", studyId)); criteria.add(Restrictions.eq("relstudy.id", studyId)); criteria.setFetchMode("subject", FetchMode.JOIN); criteria.setFetchMode("relative", FetchMode.JOIN); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("lsp.id"), "id"); projectionList.add(Projections.property("sub.subjectUID"), "individualId"); projectionList.add(Projections.property("subGender.name"), "gender"); projectionList.add(Projections.property("subPerson.dateOfBirth"), "dob"); projectionList.add(Projections.property("subPerson.dateOfDeath"), "dod"); projectionList.add(Projections.property("subPerson.firstName"), "firstName"); projectionList.add(Projections.property("subPerson.lastName"), "lastName"); projectionList.add(Projections.property("subVitStatus.name"), "deceased"); projectionList.add(Projections.property("scfd.textDataValue"), "affectedStatus"); criteria.setProjection(projectionList); criteria.setResultTransformer(Transformers.aliasToBean(RelationshipVo.class)); relatives = criteria.list();// ww w . j a v a 2 s . c o m return relatives; }
From source file:br.com.muranodesign.dao.impl.AlunoDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Aluno> ListarNomeId() { Criteria criteria = getSession().createCriteria(Aluno.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("idAluno"), "idAluno"); projList.add(Projections.property("nome"), "nome"); criteria.setProjection(projList);//w w w . ja v a2 s .c o m criteria.setResultTransformer(Transformers.aliasToBean(Aluno.class)); List<Aluno> results = criteria.list(); return results; }
From source file:br.com.muranodesign.dao.impl.ChamadaDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Chamada> dataPresencaAtual(int id, Date data) { Criteria criteria = getSession().createCriteria(Chamada.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("presenca"), "presenca"); criteria.createAlias("aluno", "aluno"); criteria.add(Restrictions.eq("aluno.idAluno", id)); criteria.add(Restrictions.eq("data", data)); criteria.setProjection(projList).setCacheable(true); criteria.setResultTransformer(Transformers.aliasToBean(Chamada.class)); List<Chamada> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.ObjetivoDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Objetivo> listAllTeste() { Criteria criteria = getSession().createCriteria(Objetivo.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("descricao"), "descricao"); criteria.createAlias("roteiro", "roteiro"); projList.add(Projections.property("roteiro.idroteiro")); criteria.setProjection(projList).setCacheable(true); criteria.setResultTransformer(Transformers.aliasToBean(Objetivo.class)); List<Objetivo> results = criteria.list(); return results; }
From source file:br.com.muranodesign.dao.impl.ProfessorFuncionarioDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<ProfessorFuncionario> listAll() { Criteria criteria = getSession().createCriteria(ProfessorFuncionario.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("idprofessorFuncionario"), "idprofessorFuncionario"); projList.add(Projections.property("nome"), "nome"); criteria.setProjection(projList);//w w w . j ava 2 s .co m criteria.setResultTransformer(Transformers.aliasToBean(ProfessorFuncionario.class)); List<ProfessorFuncionario> results = criteria.list(); return results; }
From source file:br.com.muranodesign.dao.impl.ProfessorFuncionarioDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<ProfessorFuncionario> listarIdNome() { Criteria criteria = getSession().createCriteria(ProfessorFuncionario.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("idprofessorFuncionario"), "idprofessorFuncionario"); projList.add(Projections.property("nome"), "nome"); criteria.add(Restrictions.eq("ativo", "s")); criteria.setProjection(projList);//from w w w . ja v a 2 s. c o m criteria.setResultTransformer(Transformers.aliasToBean(ProfessorFuncionario.class)); List<ProfessorFuncionario> results = criteria.list(); return results; }
From source file:br.com.muranodesign.dao.impl.RoteiroDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Roteiro> listRoteiroRange(int primeiro, int ultimo) { Criteria criteria = getSession().createCriteria(Roteiro.class); ProjectionList projList = Projections.projectionList(); criteria.setFirstResult(primeiro);//from www.j a va2 s. c om criteria.setMaxResults(ultimo); projList.add(Projections.property("idroteiro"), "idroteiro"); projList.add(Projections.property("nome"), "nome"); criteria.setProjection(projList).setCacheable(true); criteria.setResultTransformer(Transformers.aliasToBean(Roteiro.class)); criteria.addOrder(Order.asc("nome")); List<Roteiro> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.RoteiroDAOImpl.java
License:Creative Commons License
@Override @SuppressWarnings("unchecked") public List<Roteiro> listarAnoEstudoLazy(int anoEstudo) { Criteria criteria = getSession().createCriteria(Roteiro.class); ProjectionList projList = Projections.projectionList(); criteria.createAlias("anoEstudo", "anoEstudo"); criteria.add(Restrictions.eq("anoEstudo.idanoEstudo", anoEstudo)); criteria.add(Restrictions.eqOrIsNull("ativo", 1)); projList.add(Projections.property("idroteiro"), "idroteiro"); projList.add(Projections.property("nome"), "nome"); criteria.setProjection(projList).setCacheable(true); criteria.setResultTransformer(Transformers.aliasToBean(Roteiro.class)); List<Roteiro> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.TutoriaDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Tutoria> listarDadosPertinentes() { Criteria criteria = getSession().createCriteria(Tutoria.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("idtutoria"), "idtutoria"); projList.add(Projections.property("tutoria"), "tutoria"); criteria.setProjection(projList).setCacheable(true); criteria.setResultTransformer(Transformers.aliasToBean(Tutoria.class)); List<Tutoria> results = criteria.list(); return results; }