List of usage examples for org.hibernate.criterion Restrictions between
public static Criterion between(String propertyName, Object low, Object high)
From source file:br.com.muranodesign.dao.impl.RegistroDiarioDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") public List<RegistroDiario> listarMes(Date ini, Date fim) { Criteria criteria = getSession().createCriteria(RegistroDiario.class); criteria.add(Restrictions.between("data", ini, fim)); List<RegistroDiario> result = criteria.list(); return result; }
From source file:br.com.muranodesign.dao.impl.RelatorioTutoriaDAOImpl.java
License:Creative Commons License
@SuppressWarnings("unchecked") @Override/*from w w w . ja v a2 s . c om*/ public List<RelatorioTutoria> getRelatorioData(Date inicio, Date fim, int idAluno) { Criteria criteria = getSession().createCriteria(RelatorioTutoria.class); criteria.add(Restrictions.between("data", inicio, fim)); criteria.createAlias("aluno", "aluno"); criteria.add(Restrictions.eq("aluno.idAluno", idAluno)); List<RelatorioTutoria> result = criteria.list(); return result; }
From source file:br.com.OCTur.control.DAO.ReservaDAO.java
public List<Reserva> pegarPorQuartoInicioFim(Quarto quarto, Date inicio, Date fim) { entitys = criteria.add(Restrictions.eq("quarto", quarto)) .add(Restrictions.or(//from ww w.j a v a 2 s . c o m Restrictions.and(Restrictions.le("inicio", inicio), Restrictions.ge("fim", inicio)), Restrictions.between("inicio", inicio, fim), Restrictions.between("fim", inicio, fim))) .list(); closeSession(); return entitys; }
From source file:br.com.OCTur.control.DAO.ReservaDAO.java
public List<Reserva> pegarPorHotelInicioFim(Hotel hotel, Date inicio, Date fim) { List<Quarto> quartos = new QuartoDAO().pegarPorHotel(hotel); if (quartos.isEmpty()) { closeSession();/* w w w.j a v a2 s .c om*/ return entitys; } entitys = criteria.add(Restrictions.between("inicio", inicio, fim)).add(Restrictions.in("quarto", quartos)) .list(); closeSession(); return entitys; }
From source file:br.com.OCTur.control.DAO.ReservaDAO.java
public List<Reserva> pegarPorOrcamentoInicioFim(Orcamento orcamento, Date inicio, Date fim) { List<Quarto> quartos = new QuartoDAO().pegarPorOrcamento(orcamento); if (quartos.isEmpty()) { closeSession();/*from w ww. j ava 2 s. c o m*/ return entitys; } entitys = criteria.add(Restrictions.between("inicio", inicio, fim)).add(Restrictions.in("quarto", quartos)) .list(); closeSession(); return entitys; }
From source file:br.com.OCTur.control.DAO.VooDAO.java
public List<Voo> pegarPorDestino(Aeroporto destino, Date inicio, Date fim) { List<Trajeto> trajetos = new TrajetoDAO().pegarPorDestino(destino); if (trajetos.isEmpty()) { closeSession();/*from w w w. j a v a 2 s . c om*/ return entitys; } entitys = criteria.add(Restrictions.in("trajeto", trajetos)) .add(Restrictions.between("datachegada", inicio, fim)).list(); closeSession(); return entitys; }
From source file:br.com.OCTur.control.DAO.VooDAO.java
public List<Voo> pegarPorDestino(Cidade destino, Date inicio, Date fim) { List<Trajeto> trajetos = new TrajetoDAO().pegarPorDestino(destino); if (trajetos.isEmpty()) { closeSession();/*from w w w . ja v a 2 s. c o m*/ return entitys; } entitys = criteria.add(Restrictions.in("trajeto", trajetos)) .add(Restrictions.between("datachegada", inicio, fim)).list(); closeSession(); return entitys; }
From source file:br.com.OCTur.control.DAO.VooDAO.java
public List<Voo> pegarPorCompanhia(Companhia companhia, Date inicio, Date fim) { List<Aviao> aviaos = new AviaoDAO().pegarPorCompanhia(companhia); if (aviaos.isEmpty()) { closeSession();/*w w w . ja va 2 s .co m*/ return entitys; } entitys = criteria.add(Restrictions.in("aviao", aviaos)) .add(Restrictions.between("datachegada", inicio, fim)).list(); closeSession(); return entitys; }
From source file:br.com.OCTur.control.DAO.VooDAO.java
public List<Voo> pegarPorAviao(Aviao aviao, Date inicio, Date fim) { entitys = criteria.add(Restrictions.eq("aviao", aviao)) .add(Restrictions.between("datachegada", inicio, fim)).list(); closeSession();//from w w w . ja v a 2s . c om return entitys; }
From source file:br.com.SistemaOCTur.dao.EventoDAO.java
public boolean validar(Evento evento) { entitys = criteria.add(Restrictions.eq("salao", evento.getSalao())) .add(Restrictions.or(Restrictions.between("inicio", evento.getInicio(), evento.getFim()), Restrictions.between("fim", evento.getInicio(), evento.getFim()), Restrictions.or(//w w w . ja v a 2 s . c om Restrictions.and(Restrictions.ge("inicio", evento.getInicio()), Restrictions.le("fim", evento.getInicio())), Restrictions.and(Restrictions.le("inicio", evento.getFim()), Restrictions.ge("fim", evento.getFim()))))) .list(); session.close(); return entitys.isEmpty(); }