Example usage for org.hibernate Query setInteger

List of usage examples for org.hibernate Query setInteger

Introduction

In this page you can find the example usage for org.hibernate Query setInteger.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setInteger(String name, int val) 

Source Link

Document

Bind a named int-valued parameter.

Usage

From source file:com.fpmislata.banco.persistence.dao.impl.hibernate.SucursalBancariaDAOImplHibernate.java

@Override
public List<SucursalBancaria> findByidEntidadBancaria(int idEntidadBancaria) {
    Session session = sessionFactory.getCurrentSession();

    Query query = session.createQuery(
            "SELECT s FROM SucursalBancaria s WHERE s.entidadBancaria.idEntidadBancaria = :idEntidadBancaria");
    query.setInteger("idEntidadBancaria", idEntidadBancaria);

    return query.list();

}

From source file:com.gdev.web.flymeapp.DAOAirplaneImpl.java

public Airplane buscarPorId(int id) {
    begin();/*from w  w w  .  j  a v a  2s.com*/
    Query q = getSession().createQuery("from Airplane where id_plane = :id");
    q.setInteger("id", id);
    Airplane p = (Airplane) q.uniqueResult();
    commit();
    close();
    return p;

}

From source file:com.gdev.web.flymeapp.DAOCredencialImpl.java

public Credencial buscarPorId(int id) {
    begin();/*w w w  .java  2s.  c  o  m*/
    Query q = getSession().createQuery("from Credencial where id_credencial = :id");
    q.setInteger("id", id);
    Credencial p = (Credencial) q.uniqueResult();
    commit();
    close();
    return p;

}

From source file:com.gdev.web.flymeapp.DaoCrewImpl.java

public Crew buscarPorId(int id) {
    begin();/*from  w  ww .  j  a va  2 s .  co m*/
    Query q = getSession().createQuery("from Crew where id_crew = :id");
    q.setInteger("id", id);
    Crew p = (Crew) q.uniqueResult();
    commit();
    close();
    return p;

}

From source file:com.gdev.web.flymeapp.DAODocumentationImlpl.java

public Documentation buscarPorId(int id) {
    begin();/*from w  ww.jav  a2 s .  com*/
    Query q = getSession().createQuery("from Documentation where id_docu = :id");
    q.setInteger("id", id);
    Documentation d = (Documentation) q.uniqueResult();
    commit();
    close();
    return d;

}

From source file:com.gdev.web.flymeapp.DAOFlightImpl.java

public Flight buscarPorId(int id) {
    begin();//from  w  w w.  j a v a  2 s. c  o m
    Query q = getSession().createQuery("from Flight where id_flight = :id");
    q.setInteger("id", id);
    Flight p = (Flight) q.uniqueResult();
    commit();
    close();
    return p;

}

From source file:com.gdev.web.flymeapp.DAOLicenciaImpl.java

public Licencia buscarPorId(int id) {
    begin();//from   w ww.ja  v a  2 s  .com
    Query q = getSession().createQuery("from Documentation where id_licencia = :id");
    q.setInteger("id", id);
    Licencia l = (Licencia) q.uniqueResult();
    commit();
    close();
    return l;

}

From source file:com.gdev.web.flymeapp.DAOUsrImpl.java

public Usr buscarPorId(int id) {
    begin();// w w w .jav a2s .  co m
    Query q = getSession().createQuery("from Usr where idUsr = :id");
    q.setInteger("id", id);
    Usr p = (Usr) q.uniqueResult();
    commit();
    close();
    return p;

}

From source file:com.googlecode.fahweb.dao.UserDao.java

License:Open Source License

/**
 * <p>listUserForTeam.</p>/*w w w .ja va 2  s . co m*/
 *
 * @param team a int.
 * @param firstResult a int.
 * @param maxResults a int.
 * @return a {@link java.util.List} object.
 */
@Transactional
public List<User> listUserForTeam(int team, int firstResult, int maxResults) {
    Query query = sessionFactory.getCurrentSession()
            .createQuery("FROM User WHERE team=:team ORDER BY newCredit DESC");
    query.setFirstResult(firstResult);
    query.setMaxResults(maxResults);
    query.setInteger("team", team);
    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();
}