List of usage examples for org.hibernate Query setLockMode
Query<R> setLockMode(String alias, LockMode lockMode);
From source file:entity.RicaricaDAO.java
public static java.util.Iterator iterateRicaricaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Ricarica as Ricarica"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w ww . j a v a2s . c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.RichiestaDAO.java
public static Richiesta[] listRichiestaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Richiesta as Richiesta"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {// w w w . j ava2 s .c o m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Richiesta[]) list.toArray(new Richiesta[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.RichiestaDAO.java
public static java.util.Iterator iterateRichiestaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Richiesta as Richiesta"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from ww w .j a va2 s . c om Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.TerminaleDAO.java
public static Terminale[] listTerminaleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Terminale as Terminale"); 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 . c om*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Terminale[]) list.toArray(new Terminale[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.TerminaleDAO.java
public static java.util.Iterator iterateTerminaleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Terminale as Terminale"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from www . j a v a2 s. c om Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.TesseraDAO.java
public static Tessera[] listTesseraByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Tessera as Tessera"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w ww . ja va 2 s . co m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Tessera[]) list.toArray(new Tessera[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.TesseraDAO.java
public static java.util.Iterator iterateTesseraByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Tessera as Tessera"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w w w.ja v a 2s. c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.TransizioneDAO.java
public static Transizione[] listTransizioneByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Transizione as Transizione"); 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 . c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Transizione[]) list.toArray(new Transizione[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.TransizioneDAO.java
public static java.util.Iterator iterateTransizioneByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Transizione as Transizione"); 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 o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.UtenteDAO.java
public static Utente[] listUtenteByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Utente as Utente"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w w w . j av a 2s .c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Utente[]) list.toArray(new Utente[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }