List of usage examples for org.hibernate Criteria setResultTransformer
public Criteria setResultTransformer(ResultTransformer resultTransformer);
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Servidores> getSOUnix() { log.fine("[ " + userInfo.getLoggedUsername() + " ] getSOUnix()"); try {// w w w. j a v a 2 s . c o m final Criteria criteria = session().createCriteria(Servidores.class); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return criteria.add(Restrictions.eq("SO", "UNIX")).list(); } catch (Exception e) { log.severe("[ " + userInfo.getLoggedUsername() + " ] Error: " + e); return new ArrayList<Servidores>(); } }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Servidores> getHostnamesWithLogDir() { log.fine("[ " + userInfo.getLoggedUsername() + " ] getHostnamesWithLogDir()"); try {/*from ww w. j a va 2 s. co m*/ final Criteria getHostnamesWithLogDir = session().createCriteria(Servidores.class); getHostnamesWithLogDir.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); getHostnamesWithLogDir.add(Restrictions.ne("logDir", "")); return getHostnamesWithLogDir.list(); } catch (Exception e) { log.severe("Error: " + e); return new ArrayList<Servidores>(); } }
From source file:br.com.hrstatus.dao.impl.ServersDAO.java
License:Open Source License
public Servidores getServerLogDir(String hostname) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getServerLogDir(String " + hostname + ")"); final Criteria criteria = session().createCriteria(Servidores.class); criteria.add(Restrictions.eq("hostname", hostname)); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return (Servidores) criteria.uniqueResult(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Users> listUser() { log.fine("[ " + userInfo.getLoggedUsername() + " ] listUser()"); final Criteria criteria = session().createCriteria(Users.class); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return criteria.list(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Users> getBlockedUsers() { log.fine(/*from www . j a v a 2 s . c o m*/ "[ " + userInfo.getLoggedUsername() + " ] List<Users> getBlockedUsers() -> Listing blocked users."); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("enabled", false)); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return criteria.list(); }
From source file:br.com.hslife.orcamento.repository.FechamentoPeriodoRepository.java
License:Open Source License
@SuppressWarnings("unchecked") public List<FechamentoPeriodo> findAllByConta(Conta conta) { Criteria criteria = getSession().createCriteria(FechamentoPeriodo.class); criteria.add(Restrictions.eq("conta.id", conta.getId())); criteria.addOrder(Order.desc("data")); return criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list(); }
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);/*from ww w . j av a 2s . com*/ 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);/*from w w w .ja v a2 s .c om*/ criteria.setResultTransformer(Transformers.aliasToBean(ProfessorFuncionario.class)); List<ProfessorFuncionario> results = criteria.list(); return results; }