List of usage examples for org.hibernate Query setLong
@Deprecated @SuppressWarnings("unchecked") default Query<R> setLong(String name, long val)
From source file:com.globalsight.everest.tuv.TuvManagerLocal.java
License:Apache License
/** * Gets the TaskTuvs from the end of each of the previous stages of the * workflow in reverse chronological order. The parameter p_maxResultNum is * ignored.//from w w w .java2 s .co m * * @param p_tuvId * unique identifier of a Tuv object. * @param p_maxResultNum * maximum number of TaskTuvs to return. * @return reverse chronological ordered List of TaskTuvs. * @throws TuvException * when an error occurs. * @throws RemoteException * when a communication-related error occurs. */ public List getPreviousTaskTuvs(long p_tuvId, int p_maxResultNum) throws TuvException, RemoteException { String hql = " from TaskTuv t where t.currentTuvId= :tuvId order by t.version desc"; Session session = HibernateUtil.getSession(); Query query = session.createQuery(hql); query.setMaxResults(p_maxResultNum); query.setLong("tuvId", p_tuvId); List taskTuvs = query.list(); // session.close(); if (CATEGORY.isDebugEnabled()) { CATEGORY.debug("getPreviousTaskTuvs" + " p_tuvId=" + p_tuvId + " returned " + taskTuvs.size() + " TaskTuvs=" + taskTuvs.toString()); } return taskTuvs; }
From source file:com.google.code.mymon3y.persistencia.dao.hibernate.TransacaoDAOHibernate.java
License:Open Source License
@SuppressWarnings("unchecked") /* (non-Javadoc)//from ww w .j a v a2 s .c om * @see com.google.code.mymon3y.persistencia.dao.TransacaoDAO#getTransacoes(java.lang.String, java.lang.Long) */ @Override public List<Transacao> getTransacoes(final String login, final Long idCategoria) throws PersistenciaMyMon3yException { List<Transacao> result = null; result = (List<Transacao>) executarOperacao(new Comando() { public Object executar() { Query q = getSession().getNamedQuery("transacao.todasTransacoesLoginDoUsuarioIdCategoria"); q.setString("loginDoUsuario", login); q.setLong("idCategoria", idCategoria); return q.list(); } }); return result; }
From source file:com.google.code.mymon3y.persistencia.dao.hibernate.TransacaoDAOHibernate.java
License:Open Source License
/** * @see com.google.code.mymon3y.persistencia.dao.TransacaoDAO#getNotificacoes(java.lang.Long, java.util.Date) *//*w w w.j a va 2s .c o m*/ @Override public Long getNotificacoes(final Long idDoUsuario, final Date data) throws PersistenciaMyMon3yException { Long result = null; result = (Long) executarOperacao(new Comando() { public Object executar() { Query q = getSession().getNamedQuery("transacao.porUsuarioEData"); q.setLong("idDoUsuario", idDoUsuario); q.setDate("data", data); return q.uniqueResult(); } }); return result; }
From source file:com.gotour.daos.TourDaoImpl.java
public List<Tour> getTours(City city) { String hql = "from Tour t where city_fk = :city"; Query query = getSession().createQuery(hql); query.setLong("city", city.getId()); return query.list(); }
From source file:com.gotour.daos.TourDaoImpl.java
public List<Tour> getTours(Theme t) { String hql = "from Tour t where theme_fk = :theme"; Query query = getSession().createQuery(hql); query.setLong("theme", t.getId()); return query.list(); }
From source file:com.gp.cong.lcl.common.constant.ExportUnitQueryUtils.java
public String getINTRCargo(int pol, int pod, Long unitSsId, List fileList) throws Exception { StringBuilder sb = new StringBuilder(); sb.append(/*from w w w . ja v a 2 s . c o m*/ " SELECT GROUP_CONCAT(distinct fn.fileId) FROM (SELECT distinct bkp.file_number_id AS fileId FROM lcl_booking_piece bkp "); if (null != unitSsId) { sb.append(" Left JOIN lcl_booking_piece_unit bpu ON bpu.`booking_piece_id` = bkp.`id` "); sb.append(" JOIN lcl_unit_ss luss ON luss.id = bpu.`lcl_unit_ss_id` WHERE luss.id =:unitSsId ) fn"); } else { sb.append(" where bkp.file_number_id in(:fileList) )fn"); } sb.append(" JOIN lcl_booking b ON b.`file_number_id` = fn.fileId "); sb.append(" JOIN lcl_file_number f ON f.`id` = b.`file_number_id` "); sb.append(" JOIN lcl_booking_piece bp ON bp.`file_number_id` = f.`id` JOIN lcl_booking_dispo dispo "); sb.append( " ON b.`file_number_id` = dispo.`file_number_id` JOIN disposition d ON dispo.`disposition_id` = d.id "); sb.append( " AND d.`elite_code` = (SELECT d.`elite_code` FROM lcl_booking_dispo dispo JOIN disposition d "); sb.append( " ON d.`id` = dispo.`disposition_id` WHERE dispo.`file_number_id` = b.`file_number_id` ORDER BY dispo.id DESC LIMIT 1) "); sb.append(" WHERE b.`pol_id` =:pol AND b.`pod_id` =:pod AND d.`elite_code` = 'INTR' "); Query queryObject = getCurrentSession().createSQLQuery(sb.toString()); if (null != unitSsId) { queryObject.setLong("unitSsId", unitSsId); } else { queryObject.setParameterList("fileList", fileList); } queryObject.setInteger("pol", pol); queryObject.setInteger("pod", pod); return (String) queryObject.uniqueResult(); }
From source file:com.gp.cong.lcl.common.constant.ExportUnitQueryUtils.java
public String toArriveBookingList(Long unitssId, int poo, int pol, List fileList) throws Exception { StringBuilder sb = new StringBuilder(); sb.append(/* w w w. j a v a 2s . co m*/ " SELECT GROUP_CONCAT(distinct fn.fileId) FROM (SELECT distinct bkp.file_number_id AS fileId FROM lcl_booking_piece bkp "); sb.append(" join lcl_booking b on b.file_number_id = bkp.file_number_id "); if (null != unitssId) { sb.append( " Left JOIN lcl_booking_piece_unit bpu ON bpu.`booking_piece_id` = bkp.`id` JOIN lcl_unit_ss luss ON luss.id = bpu.`lcl_unit_ss_id` "); } sb.append(getBookingDispo()); sb.append(" WHERE b.poo_id =:poo AND b.`pol_id` =:pol "); if (null != unitssId) { sb.append(" and luss.id =:unitSsId "); } else { sb.append(" and bkp.file_number_id in(:fileList) "); } sb.append(" AND d.`elite_code` = 'OBKG' ) fn "); Query queryObject = getCurrentSession().createSQLQuery(sb.toString()); queryObject.setInteger("poo", poo); queryObject.setInteger("pol", pol); if (null != unitssId) { queryObject.setLong("unitSsId", unitssId); } else { queryObject.setParameterList("fileList", fileList); } return (String) queryObject.uniqueResult(); }
From source file:com.gp.cong.lcl.common.constant.ExportUnitQueryUtils.java
public String getGeneralCargoBkgList(Long unitssId, String serviceType, List fileList) throws Exception { StringBuilder sb = new StringBuilder(); String secure_cargo = getSecureCargoBkgList(unitssId, serviceType, fileList); String ups_cargo = getUPSCargoBkgList(unitssId, serviceType, fileList); String hazmat_cargo = getHazmatCargoBkgList(unitssId, serviceType, fileList); secure_cargo = null != secure_cargo ? secure_cargo + "," : ""; ups_cargo = null != ups_cargo ? ups_cargo + "," : ""; hazmat_cargo = null != hazmat_cargo ? hazmat_cargo : ""; String booking_ids = secure_cargo + "" + ups_cargo + "" + hazmat_cargo; List secure_ups_bkg = !"".equalsIgnoreCase(booking_ids) ? Arrays.asList(booking_ids.split(",")) : new ArrayList(); sb.append(/*from w w w .jav a2 s . c o m*/ " SELECT GROUP_CONCAT(distinct fn.fileId) FROM (SELECT distinct bkp.file_number_id AS fileId FROM lcl_booking_piece bkp "); if (null != unitssId) { sb.append(" Left JOIN lcl_booking_piece_unit bpu ON bpu.`booking_piece_id` = bkp.`id` "); sb.append(" JOIN lcl_unit_ss luss ON luss.id = bpu.`lcl_unit_ss_id` "); } sb.append(getBookingDispo()); if (null != unitssId) { sb.append(" WHERE luss.id =:unitSsId "); } else { sb.append(" WHERE bkp.file_number_id in(:fileList) "); } if ("E".equalsIgnoreCase(serviceType) || "C".equalsIgnoreCase(serviceType)) { sb.append(" AND d.`elite_code` != 'INTR' "); } else if ("N".equalsIgnoreCase(serviceType)) { sb.append(" and d.`elite_code` != 'OBKG'"); } sb.append(!secure_ups_bkg.isEmpty() ? " AND bkp.file_number_id NOT IN (:BkgId)" : "").append(") fn"); Query queryObject = getCurrentSession().createSQLQuery(sb.toString()); if (null != unitssId) { queryObject.setLong("unitSsId", unitssId); } else { queryObject.setParameterList("fileList", fileList); } if (!secure_ups_bkg.isEmpty()) { queryObject.setParameterList("BkgId", secure_ups_bkg); } return (String) queryObject.uniqueResult(); }
From source file:com.gp.cong.lcl.common.constant.ExportUnitQueryUtils.java
public String getPickedCargoBkgList(Long unitssId) throws Exception { StringBuilder sb = new StringBuilder(); sb.append(// w w w .j a va2 s . com " SELECT GROUP_CONCAT(distinct fn.fileId) FROM (SELECT distinct bkp.file_number_id AS fileId FROM lcl_booking_piece bkp "); sb.append(" Left JOIN lcl_booking_piece_unit bpu ON bpu.`booking_piece_id` = bkp.`id` "); sb.append(" JOIN lcl_unit_ss luss ON luss.id = bpu.`lcl_unit_ss_id` WHERE luss.id =:unitSsId) fn"); Query queryObject = getCurrentSession().createSQLQuery(sb.toString()); queryObject.setLong("unitSsId", unitssId); return (String) queryObject.uniqueResult(); }
From source file:com.gp.cong.lcl.common.constant.ExportUnitQueryUtils.java
public String getHazmatCargoBkgList(Long unitssId, String serviceType, List fileList) throws Exception { StringBuilder sb = new StringBuilder(); sb.append(// w w w . j av a2 s. co m " SELECT GROUP_CONCAT(distinct fn.fileId) FROM (SELECT distinct bkp.file_number_id AS fileId FROM lcl_booking_piece bkp "); if (unitssId != null) { sb.append(" Left JOIN lcl_booking_piece_unit bpu ON bpu.`booking_piece_id` = bkp.`id` "); sb.append(" JOIN lcl_unit_ss luss ON luss.id = bpu.`lcl_unit_ss_id` "); } sb.append(getBookingDispo()); sb.append(" WHERE bkp.hazmat = 1 "); if (null != unitssId) { sb.append(" and luss.id =:unitSsId "); } else { sb.append(" and bkp.file_number_id IN(:fileList) "); } if ("E".equalsIgnoreCase(serviceType)) { sb.append(" AND d.`elite_code` != 'INTR' "); } else if ("N".equalsIgnoreCase(serviceType)) { sb.append(" and d.`elite_code` != 'OBKG' "); } sb.append(" ) fn"); Query queryObject = getCurrentSession().createSQLQuery(sb.toString()); if (null != unitssId) { queryObject.setLong("unitSsId", unitssId); } else { queryObject.setParameterList("fileList", fileList); } return (String) queryObject.uniqueResult(); }