List of usage examples for org.hibernate Query setInteger
@Deprecated @SuppressWarnings("unchecked") default Query<R> setInteger(String name, int val)
From source file:com.hasz.dao.HotelDAO.java
public static Hotel buscaHotelById(int idHotel) { Session sessao = HibernateUtil.getSession(); Hotel retorno = null;//from w ww .j a v a 2 s .c o m try { Query select = sessao.createQuery("from Hotel where idHotel = :idHotel"); select.setInteger("idHotel", idHotel); List<Hotel> hoteis = select.list(); if (hoteis.size() == 1) { retorno = hoteis.get(0); } } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.QuartoDAO.java
public static List<Quarto> listaQuartosByIdHotel(int idHotel) { Session sessao = HibernateUtil.getSession(); List<Quarto> retorno = null; try {/*from w w w .j a v a 2 s . c o m*/ Query select = sessao.createQuery("from Quarto where idHotel = :idHotel"); select.setInteger("idHotel", idHotel); retorno = select.list(); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.QuartoDAO.java
public static List<Quarto> listaQuartosDisponiveisByIdHotel(int idHotel) { Session sessao = HibernateUtil.getSession(); List<Quarto> retorno = null; try {// ww w . j a v a2s . c om Query select = sessao.createQuery("from Quarto where idHotel = :idHotel"); select.setInteger("idHotel", idHotel); List<Quarto> quartos = select.list(); List<Reserva> reservasEmAberto = ReservaDAO.listarReservasEmAberto(); retorno = quartos; } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.QuartoDAO.java
public static Quarto buscaQuartoById(int idQuarto) { Session sessao = HibernateUtil.getSession(); Quarto retorno = null;/* w w w. jav a 2 s.c o m*/ try { Query select = sessao.createQuery("from Quarto where idQuarto = :idQuarto"); select.setInteger("idQuarto", idQuarto); List<Quarto> quartos = select.list(); if (quartos.size() == 1) retorno = quartos.get(0); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.ReservaDAO.java
public static List<Reserva> listarReservasByIdCliente(int idCliente) { Session sessao = HibernateUtil.getSession(); List<Reserva> retorno = null; try {/* w w w .j a v a2 s . c o m*/ Query select = sessao.createQuery("from Reserva where idCliente = :idCliente"); select.setInteger("idCliente", idCliente); retorno = select.list(); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.ReservaDAO.java
public static List<Reserva> listarReservasByIdQuarto(int idQuarto) { Session sessao = HibernateUtil.getSession(); List<Reserva> retorno = null; try {/* w ww . j a v a 2s . c o m*/ Query select = sessao.createQuery("from Reserva where idQuarto = :idQuarto"); select.setInteger("idQuarto", idQuarto); retorno = select.list(); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.ReservaDAO.java
public static List<Reserva> listarReservasByIdHotel(int idHotel) { Session sessao = HibernateUtil.getSession(); List<Reserva> retorno = null; try {//from w w w. j a va 2 s.c o m Query select = sessao.createQuery("from Reserva where idHotel = :idHotel"); select.setInteger("idHotel", idHotel); retorno = select.list(); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.ReservaDAO.java
public static List<Reserva> listarReservasByIdStatusReserva(int idStatusReserva) { Session sessao = HibernateUtil.getSession(); List<Reserva> retorno = null; try {/*from w w w .j av a 2 s . c o m*/ Query select = sessao.createQuery("from Reserva where idStatusReserva = :idStatusReserva"); select.setInteger("idStatusReserva", idStatusReserva); retorno = select.list(); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.ReservaDAO.java
public static Reserva buscaServicoById(int idReserva) { Session sessao = HibernateUtil.getSession(); Reserva retorno = new Reserva(); try {//from w w w .j a v a 2s . co m Query select = sessao.createQuery("from Reserva where idReserva = :idReserva"); select.setInteger("idReserva", idReserva); List<Reserva> servicos = select.list(); if (servicos.size() == 1) retorno = servicos.get(0); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }
From source file:com.hasz.dao.ServicoDAO.java
public static Servico buscaServicoById(int idServico) { Session sessao = HibernateUtil.getSession(); Servico retorno = new Servico(); try {/*from www. j a va 2s . c o m*/ Query select = sessao.createQuery("from Servico where idServico = :idServico"); select.setInteger("idServico", idServico); List<Servico> servicos = select.list(); if (servicos.size() == 1) retorno = servicos.get(0); } catch (Exception e) { e.printStackTrace(); } finally { sessao.close(); return retorno; } }