List of usage examples for org.hibernate Query setDate
@Deprecated @SuppressWarnings("unchecked") default Query<R> setDate(String name, Date val)
From source file:br.gov.jfrj.siga.hibernate.ExDao.java
License:Open Source License
public List<ExDocumento> consultarPorModeloEAssinatura(CpOrgaoUsuario orgaoUsu, ExModelo mod, Date dtAssinaturaIni, Date dtAssinaturaFim) { if (mod != null) { final Query query = getSessao().getNamedQuery("consultarPorModeloEAssinatura"); query.setLong("idOrgaoUsu", orgaoUsu.getIdOrgaoUsu()); query.setLong("idMod", mod.getIdMod()); query.setDate("dataIni", dtAssinaturaIni); query.setDate("dataFim", dtAssinaturaFim); return query.list(); }/*w w w. j av a 2 s . c o m*/ return null; }
From source file:br.gov.jfrj.siga.hibernate.ExDao.java
License:Open Source License
public List<ExItemDestinacao> consultarAEliminar(CpOrgaoUsuario orgaoUsu, Date dtIni, Date dtFim) { final Query query = getSessao().getNamedQuery("consultarAEliminar"); query.setLong("idOrgaoUsu", orgaoUsu.getIdOrgaoUsu()); query.setDate("dtIni", dtIni); query.setDate("dtFim", dtFim); long ini = System.currentTimeMillis(); List<Object[]> results = query.list(); List<ExItemDestinacao> listaFinal = new ArrayList<ExItemDestinacao>(); for (Object[] result : results) { listaFinal.add(new ExItemDestinacao(result)); }/*from www . jav a 2 s . com*/ long fim = System.currentTimeMillis() - ini; return listaFinal; }
From source file:br.gov.jfrj.siga.hibernate.ExDao.java
License:Open Source License
public int consultarQuantidadeAEliminar(CpOrgaoUsuario orgaoUsu, Date dtIni, Date dtFim) { final Query query = getSessao().getNamedQuery("consultarQuantidadeAEliminar"); query.setLong("idOrgaoUsu", orgaoUsu.getIdOrgaoUsu()); query.setDate("dtIni", dtIni); query.setDate("dtFim", dtFim); return ((Long) query.uniqueResult()).intValue(); }
From source file:br.gov.jfrj.siga.hibernate.ExDao.java
License:Open Source License
public List<ExItemDestinacao> consultarEmEditalEliminacao(CpOrgaoUsuario orgaoUsu, Date dtIni, Date dtFim) { final Query query = getSessao().getNamedQuery("consultarEmEditalEliminacao"); query.setLong("idOrgaoUsu", orgaoUsu.getIdOrgaoUsu()); query.setDate("dtIni", dtIni); query.setDate("dtFim", dtFim); List<Object[]> results = query.list(); List<ExItemDestinacao> listaFinal = new ArrayList<ExItemDestinacao>(); for (Object[] result : results) { listaFinal.add(new ExItemDestinacao(result)); }//ww w . ja va 2s . c om return listaFinal; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.AbsenceDao.java
@Override public Absence findAbsenceByPremierJourAbsence(String idRessource) { String hql = "from Absence a " + "where a.premierJourAbsence >= :dateToday " + "and a.refRessource.idRessource = :idRessource " + "order by a.premierJourAbsence"; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); query.setDate("dateToday", new java.util.Date()); query.setMaxResults(1);// w w w . j a va2s . com Absence results = (Absence) query.uniqueResult(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.AbsenceDao.java
@Override public List<Absence> findAbsenceByEquipe(String equipeLibelle, String moisAafficher) { String hql = "select a from Absence a " + "left join a.refRessource ref " + "where ref.tags " + "like :equipeChoisie " // + "and (month(a.premierJourAbsence) = :moisAafficher or month(a.dateFinAbsence) = :moisAafficher) " + "and (year(a.premierJourAbsence) = :anneeEnCours or year(a.dateFinAbsence) = :anneeEnCours) " + "and ref.dateDepart > :date " + "order by ref.nom desc"; Query query = getSession().createQuery(hql); query.setParameter("equipeChoisie", '%' + equipeLibelle + '%'); query.setParameter("anneeEnCours", Calendar.getInstance().get(Calendar.YEAR)); query.setDate("date", new java.util.Date()); // query.setParameter("moisAafficher", ConvertUtils.parseInteger(moisAafficher) + 1 ); List<Absence> results = (List<Absence>) query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.CufControleIncoherenceDao.java
@Override public List<CufControleIncoherence> findNbIncoherence(String idRessource) { String hql = "from CufControleIncoherence a " + "where a.dateDerniereDetection = :dateToday " + "and a.idRessource = :idRessource"; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); query.setDate("dateToday", new java.util.Date()); List<CufControleIncoherence> results = (List<CufControleIncoherence>) query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.ForfaitBudgetDao.java
@Override public List<ForfaitBudget> findForfaitModalDm() { String hql = "from ForfaitBudget a " + "where a.dateFinForfaitBudget > :dateToday "; Query query = getSession().createQuery(hql); query.setDate("dateToday", new java.util.Date()); List<ForfaitBudget> results = query.list(); return results; }
From source file:ch.eggbacon.app.service.PreisServiceImpl.java
License:Open Source License
@Override public List<Preis> getPreisByDatum(Date d) { Query q = getSession().createQuery("FROM " + TABLE_NAME + " WHERE Datum = :datum"); q.setDate("datum", d); return q.list(); }
From source file:classroom.filmfestival_c.Movies16.java
@SuppressWarnings("unchecked") public static void main(String[] args) { // step 1/*from w w w . j a v a 2 s. c om*/ Document document = new Document(); try { // step 2 OutputStream os = new FileOutputStream(RESULT); PdfWriter.getInstance(document, os); // step 3 document.open(); // step 4 PdfPTable table; PdfPCell cell; Chunk imdb; Session session = (Session) MySessionFactory.currentSession(); Query q = session.createQuery( "select distinct festival.id.day from FestivalScreening as festival order by festival.id.day"); java.util.List<Date> days = q.list(); java.util.List<FestivalScreening> screenings; for (Date day : days) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(day); if (gc.get(GregorianCalendar.YEAR) != YEAR) continue; table = new PdfPTable(new float[] { 7, 1, 2, 1 }); cell = new PdfPCell(new Phrase(day.toString(), NORMALWHITE)); cell.setBackgroundColor(BLACK); cell.setColspan(4); table.addCell(cell); q = session.createQuery("from FestivalScreening where id.day=? order by id.time, id.place"); q.setDate(0, day); screenings = q.list(); for (FestivalScreening screening : screenings) { table.addCell(screening.getFilmTitle().getTitle()); table.addCell(screening.getId().getPlace().toString()); cell = new PdfPCell(new Phrase(screening.getId().getTime().toString())); if (screening.getPress() == 1) { cell.setBackgroundColor(SILVER); } table.addCell(cell); if (screening.getFilmTitle().getImdb().startsWith("?")) { table.addCell(""); } else { imdb = new Chunk("imdb"); imdb.setAnchor("http://imdb.com/title/tt" + screening.getFilmTitle().getImdb()); table.addCell(new Phrase(imdb)); } } document.add(table); } // step 5 document.close(); } catch (IOException e) { LOGGER.error("IOException: ", e); } catch (DocumentException e) { LOGGER.error("DocumentException: ", e); } }