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:AdministrativoObra.java

public static List queryAdministrativoObra(PersistentSession session, String condition, String orderBy)
         throws PersistentException {
     StringBuffer sb = new StringBuffer("From AdministrativoObra as AdministrativoObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from  w w  w . j  ava2 s .  com
         Query query = session.createQuery(sb.toString());
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:AdministrativoObra.java

public static List queryAdministrativoObra(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From AdministrativoObra as AdministrativoObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from   w w w.  ja  va2 s .c o m
         Query query = session.createQuery(sb.toString());
         query.setLockMode("AdministrativoObra", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Empleado.java

public static List queryEmpleado(PersistentSession session, String condition, String orderBy)
         throws PersistentException {
     StringBuffer sb = new StringBuffer("From Empleado as Empleado");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/*from  w  w  w.j ava 2  s. c  o  m*/
         Query query = session.createQuery(sb.toString());
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Empleado.java

public static List queryEmpleado(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Empleado as Empleado");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from ww w.  j  a  v a 2s  .  c  om
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Empleado", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:PeriodoMaquinariaEnObra.java

public static List queryPeriodoMaquinariaEnObra(PersistentSession session, String condition, String orderBy)
         throws PersistentException {
     StringBuffer sb = new StringBuffer("From PeriodoMaquinariaEnObra as PeriodoMaquinariaEnObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/*from  w w w.j a v a2  s .  co  m*/
         Query query = session.createQuery(sb.toString());
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:PeriodoMaquinariaEnObra.java

public static List queryPeriodoMaquinariaEnObra(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From PeriodoMaquinariaEnObra as PeriodoMaquinariaEnObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/* w ww .ja v a  2  s .  c  o  m*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("PeriodoMaquinariaEnObra", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Maquinaria.java

public static List queryMaquinaria(PersistentSession session, String condition, String orderBy)
         throws PersistentException {
     StringBuffer sb = new StringBuffer("From Maquinaria as Maquinaria");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from   ww w . j av  a  2s  .  c  o  m
         Query query = session.createQuery(sb.toString());
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Maquinaria.java

public static List queryMaquinaria(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Maquinaria as Maquinaria");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//w  w  w  . j av  a  2 s . co  m
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Maquinaria", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:MaterialParaObra.java

public static List queryMaterialParaObra(PersistentSession session, String condition, String orderBy)
         throws PersistentException {
     StringBuffer sb = new StringBuffer("From MaterialParaObra as MaterialParaObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from   w ww.  ja va 2s. c  o m
         Query query = session.createQuery(sb.toString());
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:MaterialParaObra.java

public static List queryMaterialParaObra(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From MaterialParaObra as MaterialParaObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//w  w  w. j  av  a 2  s.  c om
         Query query = session.createQuery(sb.toString());
         query.setLockMode("MaterialParaObra", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }