Example usage for org.hibernate Query list

List of usage examples for org.hibernate Query list

Introduction

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

Prototype

List<R> list();

Source Link

Document

Return the query results as a List.

Usage

From source file:bgroup.oracle.dao.HelpFioDaoImpl.java

@Override
public HelpFio getHelpFio(int PATIENT_ID) {
    Session session = getSession();/*from w  w w .j  a  v  a 2s .c  o m*/
    Query query = session.createSQLQuery("SELECT \n" + "       fn_pat_name_by_id(keyid) AS fio, \n"
            + "       fn_pat_name_by_id(keyid) AS fio2, \n" + "       fn_pat_name_by_id(keyid) AS fio3, \n"
            + "       fn_pat_name_by_id(keyid) AS fio5, \n"
            + "(SELECT text FROM lu WHERE keyid = 93116) AS \"license\",\n"
            + "       fn_pat_name_by_id(keyid) AS fio4,\n"
            + "\t/*fn_man_by_id (gsp_get_user_id()) AS registrator,*/\n" + "\tSex as pol,\n"
            + "\tNVL(snils, NULL ) AS snils,\n" + "\tNVL(snils, NULL ) AS snils1,\n"
            + "\ts_spravka_num.nextval AS N,\n" + "\ts_spravka_num.nextval AS N2,\n" + "       num AS PATNUM,\n"
            + "       TO_CHAR(SYSDATE,'dd.mm.yyyy') AS GIVEDATE,\n"
            + "       TO_CHAR(SYSDATE,'dd.mm.yyyy') AS GIVEDATE2\n"
            + "FROM patient WHERE keyid = :PATIENT_ID\n")
            .setResultTransformer(Transformers.aliasToBean(HelpFio.class));
    query.setParameter("PATIENT_ID", PATIENT_ID);
    //List<Object[]> result = null;
    List<HelpFio> result = null;
    try {
        result = query.list();
    } catch (Exception e) {
        logger.error(e.toString());
    }
    Contract contract = null;
    if (result != null && result.size() == 1) {
        return result.get(0);
    } else {
        logger.info("  ");
    }
    return null;
}

From source file:biomart.DAO.AdminDAO.java

public List<CheckBean> checkDetails() {
    Session session = Util.getSessionFactory().openSession();
    Query query = session.createQuery("From CheckBean");
    List<CheckBean> checkBeans = query.list();
    session.close();//  w w w  .j  av  a  2  s . co m
    return checkBeans;
}

From source file:biomart.DAO.AdminDAO.java

public List<PaymentDetailsBean> paymentDetails() {
    Session session = Util.getSessionFactory().openSession();
    Query query = session.createQuery("From PaymentDetailsBean");
    List<PaymentDetailsBean> paymentDetailsBeans = query.list();
    session.close();/*  w w w  . ja v a2s.c o  m*/
    return paymentDetailsBeans;
}

From source file:biomart.DAO.AdminDAO.java

public List<ProductBean> getAllProdudctNames() {
    Session session = Util.getSessionFactory().openSession();
    Query query = session.createQuery("From ProductBean");
    List<ProductBean> productBeans = query.list();
    session.close();/*from www .  ja va 2 s .c  o  m*/
    return productBeans;

}

From source file:bitirme.dao.FotografDao.java

public List<Fotograf> list(Integer idKullanici) {
    session = HibernateUtil.getSessionFactory().openSession();
    String sorgu = "Select f FROM Fotograf f " + "join f.kullaniciidKullanici k "
            + "where k.idKullanici = :idKullanici";
    List<Fotograf> liste = null;

    Query q = session.createQuery(sorgu);
    q.setParameter("idKullanici", idKullanici);

    liste = q.list();
    session.close();//from  w  w w.  j av a2  s .co  m
    return liste;
}

From source file:bo.com.kibo.dal.impl.DAOGenericoHibernate.java

@Override
public List<T> obtenerNuevosObjetos(Date ultimaFecha) {
    if (ISincronizable.class.isAssignableFrom(getPersistentClass())) {
        Query query = getSession()
                .createQuery("from " + getPersistentClass().getName() + " c where c.modificado > :fecha");
        return query.list();
    }/*  w w  w  . j a  va  2  s .  c  o  m*/
    return new ArrayList<>();
}

From source file:bo.com.kibo.dal.impl.FajaHibernateDAO.java

@Override
public List<Faja> obtenerFajasSegunArea(Integer idArea) {
    Query query = getSession().createQuery("from Faja f Where f.area.id = :idArea");
    query.setParameter("idArea", idArea);
    return query.list();
}

From source file:bo.com.kibo.dal.impl.GeoLugarHibernateDAO.java

@Override
public List<PuntoXY> getPoligono(Integer idLugar) {
    Query query = getSession().createSQLQuery("");

    return query.list();
}

From source file:bo.com.kibo.dal.impl.PatioHibernateDAO.java

@Override
public List<Patio> obtenerPatiosSegunArea(Integer idArea) {
    Query query = getSession().createQuery("from Patio p Where p.area.id = :idArea");
    query.setParameter("idArea", idArea);
    return query.list();
}

From source file:bo.com.kibo.dal.impl.ReporteHibernateDAO.java

@Override
public List<TrozaGeneral> obtenerTrozasGeneral() {
    Query query = getSession().createQuery("from TrozaGeneral");
    return query.list();
}