List of usage examples for org.hibernate Query setLockMode
Query<R> setLockMode(String alias, LockMode lockMode);
From source file:ma.massarpro.dao.impl.ClasseDAOImpl.java
public Classe[] listClasseByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Classe as Classe"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//w w w .ja v a 2 s.com Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Classe[]) list.toArray(new Classe[list.size()]); } catch (Exception e) { _logger.error("listClasseByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.ClasseDAOImpl.java
public static java.util.Iterator iterateClasseByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Classe as Classe"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from ww w . ja v a 2 s. co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateClasseByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.ControleDAOImpl.java
public Controle[] listControleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Controle as Controle"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w ww. j av a2 s . co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Controle[]) list.toArray(new Controle[list.size()]); } catch (Exception e) { _logger.error("listControleByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.ControleDAOImpl.java
public static java.util.Iterator iterateControleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Controle as Controle"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* ww w . j a va 2 s .co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateControleByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.EmploieDAOImpl.java
public Emploie[] listEmploieByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Emploie as Emploie"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from ww w. ja v a 2 s. c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Emploie[]) list.toArray(new Emploie[list.size()]); } catch (Exception e) { _logger.error("listEmploieByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.EmploieDAOImpl.java
public static java.util.Iterator iterateEmploieByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Emploie as Emploie"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {// w w w . ja va 2s . co m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateEmploieByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.EtudiantDAOImpl.java
public Etudiant[] listEtudiantByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Etudiant as Etudiant"); 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 a2s.c om*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Etudiant[]) list.toArray(new Etudiant[list.size()]); } catch (Exception e) { _logger.error("listEtudiantByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.EtudiantDAOImpl.java
public static java.util.Iterator iterateEtudiantByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Etudiant as Etudiant"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w ww .j av a2s . c om Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateEtudiantByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.MatiereDAOImpl.java
public Matiere[] listMatiereByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Matiere as Matiere"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* ww w.j av a 2 s . com*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Matiere[]) list.toArray(new Matiere[list.size()]); } catch (Exception e) { _logger.error("listMatiereByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.MatiereDAOImpl.java
public static java.util.Iterator iterateMatiereByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Matiere as Matiere"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* w w w .j a v a 2 s. com*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateMatiereByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }