List of usage examples for org.hibernate Query setLong
@Deprecated @SuppressWarnings("unchecked") default Query<R> setLong(String name, long val)
From source file:com.slambook.repository.implementation.QuestionDAOImpl.java
@Override public ArrayList<Questions> fetchQuestionsOfSlambook(Slambook slambook) { Query query = sessionFactory.getCurrentSession().getNamedQuery("Slambook.getQuestions"); query.setLong("slambookId", slambook.getSlambookId()); return (ArrayList<Questions>) query.list(); }
From source file:com.slambook.repository.implementation.UserInfoDAOImpl.java
@Override public String getUserEmailById(long userId) { Query query = sessionFactory.getCurrentSession().getNamedQuery("UserInfo.getEmailById"); query.setLong("userId", userId); return (String) query.uniqueResult(); }
From source file:com.slambook.repository.implementation.UserInfoDAOImpl.java
@Override public boolean isAFriend(long userId, long friendId) { Query query = sessionFactory.getCurrentSession().getNamedQuery("SlambookAnswers.isAFriend"); query.setLong("userId", userId); query.setLong("senderId", friendId); return (Boolean) query.uniqueResult(); }
From source file:com.sos.jobnet.db.JobNetEdgesDBLayer.java
License:Apache License
private Query setQueryParams(String hql) { Query query = session.createQuery(hql); if (filter.getSchedulerId() != null && !filter.getSchedulerId().equals("")) { query.setParameter(SCHEDULER_ID, filter.getSchedulerId()); }/*from ww w . j ava 2 s. c om*/ if (filter.getNode() != null && !filter.getNode().equals("")) { query.setParameter(NODE, filter.getNode()); } if (filter.getJobChain() != null && !filter.getJobChain().equals("")) { query.setParameter(JOB_CHAIN, filter.getJobChain()); } if (filter.getParentNodeId() != null) { query.setLong(PARENT_NODE_ID, filter.getParentNodeId()); } if (filter.getChildNodeId() != null) { query.setLong(CHILD_NODE_ID, filter.getChildNodeId()); } if (filter.getEdgeType() != null && filter.getEdgeType().getEdgeType() != null && !filter.getEdgeType().getEdgeType().equals("")) { query.setParameter(EDGE_TYPE, filter.getEdgeType().getEdgeType()); } return query; }
From source file:com.sos.jobnet.db.JobNetNodeDBLayer.java
License:Apache License
private Query setQueryParams(String hql) { Query query = session.createQuery(hql); if (filter.getSchedulerId() != null && !filter.getSchedulerId().equals("")) { query.setParameter(SCHEDULER_ID, filter.getSchedulerId()); }//w w w. j av a2 s . c o m if (filter.getNode() != null && !filter.getNode().equals("")) { query.setParameter(NODE, filter.getNode()); } if (filter.getJobnet() != null && !filter.getJobnet().equals("")) { query.setParameter(JOB_NET, filter.getJobnet()); } if (filter.getNodeId() != null) { query.setLong(NODE_ID, filter.getNodeId()); } return query; }
From source file:com.sos.jobnet.db.JobNetPlanDBLayer.java
License:Apache License
private Query setQueryParams(String hql) { Query query = session.createQuery(hql); if (filter.getPlannedStartTimeFrom() != null && !filter.getPlannedStartTimeFrom().equals("")) { query.setTimestamp(PLANNED_START_TIME_FROM, filter.getPlannedStartTimeFrom()); }/* w w w .ja va 2 s. co m*/ if (filter.getPlannedStartTimeTo() != null && !filter.getPlannedStartTimeTo().equals("")) { query.setTimestamp(PLANNED_START_TIME_TO, filter.getPlannedStartTimeTo()); } if (filter.getStartTimeFrom() != null && !filter.getStartTimeFrom().equals("")) { query.setTimestamp(START_TIME_FROM, filter.getStartTimeFrom()); } if (filter.getStartTimeTo() != null && !filter.getStartTimeTo().equals("")) { query.setTimestamp(START_TIME_TO, filter.getStartTimeTo()); } if (filter.getSchedulerId() != null && !filter.getSchedulerId().equals("")) { query.setParameter(SCHEDULER_ID, filter.getSchedulerId()); } if (filter.getUuid() != null && !filter.getUuid().equals("")) { query.setParameter(UUID, filter.getUuid()); } if (filter.getNode() != null && !filter.getNode().equals("")) { query.setParameter(NODE, filter.getNode()); } if (filter.getNodeId() != null) { query.setLong(NODE_ID, filter.getNodeId()); } if (filter.getSubnetId() != null) { query.setLong(SUBNET_ID, filter.getSubnetId()); } if (filter.getConnectorId() != null) { query.setLong(CONNECTOR_ID, filter.getConnectorId()); } if (filter.getNodeType() != null) { query.setParameter(NODE_TYPE, filter.getNodeType()); } if (filter.getPlanId() != null) { query.setLong(PLAN_ID, filter.getPlanId()); } if (filter.getJobnet() != null && !filter.getJobnet().equals("")) { query.setParameter(JOBNET, filter.getJobnet()); } if (filter.getStatus() != null && !filter.getStatus().equals("")) { query.setInteger(STATUS, filter.getStatus()); } if (filter.getStatusWaiter() != null && !filter.getStatusWaiter().equals("")) { query.setInteger(STATUS_WAITER, filter.getStatusWaiter()); } if (filter.getStatusRunner() != null && !filter.getStatusRunner().equals("")) { query.setInteger(STATUS_RUNNER, filter.getStatusRunner()); } if (filter.getStatusDispatcher() != null && !filter.getStatusDispatcher().equals("")) { query.setInteger(STATUS_DISPATCHER, filter.getStatusDispatcher()); } if (filter.getIsWaiterSkipped() != null) { query.setBoolean(IS_WAITER_SKIPPED, filter.getIsWaiterSkipped()); } if (filter.getIsRunnerOnDemand() != null) { query.setBoolean(IS_RUNNER_ON_DEMAND, filter.getIsRunnerOnDemand()); } if (filter.getIsRunnerSkipped() != null) { query.setBoolean(IS_RUNNER_SKIPPED, filter.getIsRunnerSkipped()); } if (filter.getBootstrap() != null) { query.setBoolean(BOOTSTRAP, filter.getBootstrap()); } if (filter.getIsDispatcherSkipped() != null) { query.setBoolean(IS_DISPATCHER_SKIPPED, filter.getIsDispatcherSkipped()); } return query; }
From source file:com.sos.scheduler.history.db.SchedulerOrderHistoryDBLayer.java
License:Apache License
public SchedulerOrderHistoryDBItem getOrderHistoryItem() { initSession();/* www .j a va 2 s . c o m*/ this.filter.setLimit(1); Query query = session.createQuery("from SchedulerOrderHistoryDBItem " + getWhere()); if (filter.getSchedulerOrderHistoryId() != null) { query.setLong("schedulerOrderHistoryId", filter.getSchedulerOrderHistoryId()); } else { if (filter.getStartTime() != null && !filter.getStartTime().equals("")) { query.setTimestamp("startTime", filter.getStartTime()); } if (filter.getEndTime() != null && !filter.getEndTime().equals("")) { query.setTimestamp("endTime", filter.getEndTime()); } if (filter.getOrderid() != null && !filter.getOrderid().equals("")) { query.setText("orderId", filter.getOrderid()); } if (filter.getJobchain() != null && !filter.getJobchain().equals("")) { query.setText("jobChain", filter.getJobchain()); } if (filter.getSchedulerId() != null && !filter.getSchedulerId().equals("")) { query.setText("schedulerId", filter.getSchedulerId()); } } query.setMaxResults(filter.getLimit()); List<SchedulerOrderHistoryDBItem> historyList = query.list(); if (historyList.size() > 0) { return historyList.get(0); } else { return null; } }
From source file:com.square.adherent.noyau.dao.implementations.contrat.ContratDaoImpl.java
License:Open Source License
@Override @SuppressWarnings("unchecked") // TODO manque la colonne contrat_adhesion_onum public Contrat getContratSantePersonneEnCours(Long idPersonne) { final StringBuffer requete = new StringBuffer("select contrat_numero from data_contrat "); requete.append("where data_contrat.contrat_assure_uid = :idPersonne "); requete.append("and (data_contrat.contrat_statut_uid = :idStatutEnCours "); requete.append(/*from w ww .j ava 2 s . com*/ "or (data_contrat.contrat_statut_uid = :idStatutResilie and data_contrat.contrat_date_resiliation >= now())) "); requete.append("and data_contrat.contrat_nature_uid = :idNatureSante "); // requete.append("and data_contrat.contrat_adhesion_onum <> 'groupe' "); requete.append("and data_contrat.contrat_date_adhesion <= now() "); requete.append("and data_contrat.contrat_visible = true "); requete.append("group by contrat_numero"); final Query crit = createSqlQuery(requete.toString()); crit.setLong("idPersonne", idPersonne); crit.setLong("idStatutEnCours", adherentMappingService.getIdStatutContratEnCours()); crit.setLong("idStatutResilie", adherentMappingService.getIdStatutContratResilie()); crit.setLong("idNatureSante", adherentMappingService.getIdNatureContratSante()); final List<String> resultats = (ArrayList<String>) crit.list(); return resultats.size() == 1 ? ((Contrat) getContratByNumero(resultats.get(0))) : null; }
From source file:com.square.adherent.noyau.dao.implementations.contrat.ContratDaoImpl.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Contrat getContratSantePersonneInactifXMois(Long idPersonne, Calendar dateInactiviteGarantieSante) { final StringBuffer requete = new StringBuffer("select contrat_numero from data_contrat "); requete.append("where data_contrat.contrat_assure_uid = :idPersonne "); requete.append(//w w w . j a v a 2s.co m "and data_contrat.contrat_statut_uid <> :idStatutEnCours and data_contrat.contrat_nature_uid = :idNatureSante "); // requete.append("and data_contrat.contrat_adhesion_onum <> 'groupe' "); requete.append( "and data_contrat.contrat_date_resiliation < now() and data_contrat.contrat_date_resiliation >= :dateInactiviteGarantieSante "); requete.append("and data_contrat.contrat_visible = true "); requete.append("group by contrat_numero "); final Query crit = createSqlQuery(requete.toString()); crit.setLong("idPersonne", idPersonne); crit.setLong("idStatutEnCours", adherentMappingService.getIdStatutContratEnCours()); crit.setLong("idNatureSante", adherentMappingService.getIdNatureContratSante()); crit.setCalendar("dateInactiviteGarantieSante", dateInactiviteGarantieSante); final List<String> resultats = (ArrayList<String>) crit.list(); return resultats.size() == 1 ? ((Contrat) getContratByNumero(resultats.get(0))) : null; }
From source file:com.square.adherent.noyau.dao.implementations.contrat.ContratDaoImpl.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public Contrat getContratSantePersonneAVenir(Long idPersonne) { final StringBuffer requete = new StringBuffer("select contrat_numero from data_contrat "); requete.append("where data_contrat.contrat_assure_uid = :idPersonne "); requete.append("and data_contrat.contrat_statut_uid = :idStatutFutur "); requete.append("and data_contrat.contrat_nature_uid = :idNatureSante "); // requete.append("and data_contrat.contrat_adhesion_onum <> 'groupe' "); requete.append("and data_contrat.contrat_date_adhesion > now() "); requete.append("and data_contrat.contrat_visible = true "); requete.append("group by contrat_numero"); final Query crit = createSqlQuery(requete.toString()); crit.setLong("idPersonne", idPersonne); crit.setLong("idStatutFutur", adherentMappingService.getIdStatutContratFutur()); crit.setLong("idNatureSante", adherentMappingService.getIdNatureContratSante()); final List<String> resultats = (ArrayList<String>) crit.list(); return resultats.size() == 1 ? ((Contrat) getContratByNumero(resultats.get(0))) : null; }