Example usage for org.hibernate Session createQuery

List of usage examples for org.hibernate Session createQuery

Introduction

In this page you can find the example usage for org.hibernate Session createQuery.

Prototype

@Override
    org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);

Source Link

Usage

From source file:appcostal.model.DAO.java

public Hermano obtenerHermano(String dni) {
    Hermano hermano = null;/* www  .  j  av a 2  s . c om*/
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Hermano where dni='" + dni + "'");
    List<Hermano> lista = (List<Hermano>) q.list();
    if (!lista.isEmpty()) {
        hermano = lista.get(0);
    }
    tx.commit();
    se.close();
    return hermano;
}

From source file:appcostal.model.DAO.java

public List<Paso> pasosDisponibles() {
    List<Paso> pasos;/*from  w w  w  .  java 2  s  . c o  m*/
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Paso");
    pasos = (List<Paso>) q.list();
    tx.commit();
    se.close();
    return pasos;
}

From source file:appcostal.model.DAO.java

public List<Iguala> igualasDisponibles() {
    List<Iguala> igualas;//from   w w  w  . j  a  v a  2s.  com
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Iguala");
    igualas = (List<Iguala>) q.list();
    tx.commit();
    se.close();
    return igualas;
}

From source file:appcostal.model.DAO.java

public Iguala obtenerIguala(String idiguala) {
    Iguala iguala = null;// w ww.  j  a  v a 2  s.  c o m
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Iguala where idiguala='" + idiguala + "'");
    List<Iguala> lista = (List<Iguala>) q.list();
    if (!lista.isEmpty()) {
        iguala = lista.get(0);
    }
    tx.commit();
    se.close();
    return iguala;
}

From source file:appcostal.model.DAO.java

public List<Recorrido> recorridosDisponibles() {
    List<Recorrido> recorridos;
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();//  w w w . j ava  2s  . com
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Recorrido");
    recorridos = (List<Recorrido>) q.list();
    tx.commit();
    se.close();
    return recorridos;
}

From source file:appcostal.model.DAO.java

public Recorrido obtenerRecorrido(String idrecorrido) {
    Recorrido recorrido = null;/*from ww  w .j  a  v  a 2  s  .c  o  m*/
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Recorrido where idrecorrido='" + idrecorrido + "'");
    List<Recorrido> lista = (List<Recorrido>) q.list();
    if (!lista.isEmpty()) {
        recorrido = lista.get(0);
    }
    tx.commit();
    se.close();
    return recorrido;
}

From source file:appcostal.model.DAO.java

public Hermandad obtenerHermandad(String idhermandad) {
    Hermandad hermandad = null;//from  ww  w  . j  ava  2 s.c  o  m
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Hermandad where idhermandad='" + idhermandad + "'");
    List<Hermandad> lista = (List<Hermandad>) q.list();
    if (!lista.isEmpty()) {
        hermandad = lista.get(0);
    }
    tx.commit();
    se.close();
    return hermandad;
}

From source file:appcostal.model.DAO.java

public Paso obtenerPaso(String idpaso) {
    Paso paso = null;/*from ww  w .  j av  a  2  s.com*/
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Paso where idpaso='" + idpaso + "'");
    List<Paso> lista = (List<Paso>) q.list();
    if (!lista.isEmpty()) {
        paso = lista.get(0);
    }
    tx.commit();
    se.close();
    return paso;
}

From source file:appcostal.model.DAO.java

public List<Hermandad> hermandadesDisponibles() {
    List<Hermandad> hermandades;
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();/*from ww w  .  j  a  v  a  2  s .c  o  m*/
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From Hermandad");
    hermandades = (List<Hermandad>) q.list();
    tx.commit();
    se.close();
    return hermandades;
}

From source file:appcostal.model.DAO.java

public List<RelHermanoPaso> pasosDeHermano(String dni) {
    List<RelHermanoPaso> pasos;
    SessionFactory s = HibernateUtil.getSessionFactory();
    Session se;
    se = s.openSession();/*from  w w  w .  j  a  v  a2 s. c  om*/
    Transaction tx = se.beginTransaction();
    Query q = se.createQuery("From RelHermanoPaso where dni='" + dni + "'");
    pasos = (List<RelHermanoPaso>) q.list();
    tx.commit();
    se.close();
    return pasos;
}