List of usage examples for org.hibernate Criteria createAlias
public Criteria createAlias(String associationPath, String alias) throws HibernateException;
From source file:br.com.muranodesign.dao.impl.MensagensDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Mensagens> listarMensagemByProprietario(int idProprietario, int idMensagem) { Criteria criteria = getSession().createCriteria(Mensagens.class); criteria.createAlias("proprietario", "proprietario"); criteria.add(Restrictions.eq("proprietario.idusuario", idProprietario)); criteria.add(Restrictions.eq("idmensagens", idMensagem)); criteria.addOrder(Order.asc("lida")); criteria.addOrder(Order.desc("data")); criteria.addOrder(Order.desc("idmensagens")); List<Mensagens> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.MensagensDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Mensagens> listarRemetente(int id) { Criteria criteria = getSession().createCriteria(Mensagens.class); criteria.createAlias("remetente", "remetente"); criteria.add(Restrictions.eq("remetente.idusuario", id)); criteria.addOrder(Order.asc("lida")); criteria.addOrder(Order.desc("data")); criteria.addOrder(Order.desc("idmensagens")); List<Mensagens> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.MensagensDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Mensagens> listarProprietario(int id) { Criteria criteria = getSession().createCriteria(Mensagens.class); criteria.createAlias("proprietario", "proprietario"); criteria.add(Restrictions.eq("proprietario.idusuario", id)); criteria.addOrder(Order.asc("lida")); criteria.addOrder(Order.desc("data")); criteria.addOrder(Order.desc("idmensagens")); List<Mensagens> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.MensagensDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Mensagens> listarProprietarioCount(int id) { Criteria criteria = getSession().createCriteria(Mensagens.class); criteria.createAlias("proprietario", "proprietario"); criteria.add(Restrictions.eq("proprietario.idusuario", id)); criteria.add(Restrictions.eq("lida", "N")); criteria.add(Restrictions.eq("cxEntrada", "S")); criteria.add(Restrictions.eq("cxEnviada", "N")); criteria.addOrder(Order.asc("lida")); criteria.addOrder(Order.desc("data")); criteria.addOrder(Order.desc("idmensagens")); List<Mensagens> 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.ObjetivoDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Objetivo> listarRoteiro(int id) { Criteria criteria = getSession().createCriteria(Objetivo.class); criteria.createAlias("roteiro", "roteiro"); criteria.add(Restrictions.eq("roteiro.idroteiro", id)); criteria.add(Restrictions.eq("ativo", 1)); List<Objetivo> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.ObjetivoDAOImpl.java
License:Creative Commons License
public long listarRoteiroTotal(int id) { Criteria criteria = getSession().createCriteria(Objetivo.class); criteria.createAlias("roteiro", "roteiro"); criteria.add(Restrictions.eq("roteiro.idroteiro", id)); criteria.add(Restrictions.eq("roteiro.ativo", 1)); criteria.setProjection(Projections.count("ativo")); long result = (Long) criteria.list().get(0); return result; }
From source file:br.com.muranodesign.dao.impl.ObjetivoDAOImpl.java
License:Creative Commons License
public long listarGrafico(int id) { Criteria criteria = getSession().createCriteria(Objetivo.class); criteria.add(Restrictions.eq("ativo", 1)); criteria.createAlias("roteiro", "roteiro"); criteria.add(Restrictions.eq("roteiro.ativo", 1)); criteria.add(Restrictions.eq("roteiro.anoEstudo.idanoEstudo", id)); criteria.setProjection(Projections.count("ativo")); long result = (Long) criteria.list().get(0); return result; }
From source file:br.com.muranodesign.dao.impl.ObjetivoDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<Objetivo> listarGraficoEntregues(int id) { Criteria criteria = getSession().createCriteria(Objetivo.class); criteria.add(Restrictions.eq("ativo", 1)); criteria.createAlias("roteiro", "roteiro"); criteria.add(Restrictions.eq("roteiro.ativo", 1)); criteria.add(Restrictions.eq("roteiro.anoEstudo.idanoEstudo", id)); List<Objetivo> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.PlanejamentoRoteiroDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<PlanejamentoRoteiro> listarPendente(int aluno, int objetivo) { Criteria criteria = getSession().createCriteria(PlanejamentoRoteiro.class); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_YEAR, 1); criteria.add(Restrictions.ge("dataStatusPlanejado", cal.getTime())); criteria.add(Restrictions.eq("idAluno", aluno)); criteria.createAlias("objetivo", "objetivo"); criteria.add(Restrictions.eq("objetivo.idobjetivo", objetivo)); List<PlanejamentoRoteiro> result = criteria.list(); return result; }