List of usage examples for org.hibernate Query setLockMode
Query<R> setLockMode(String alias, LockMode lockMode);
From source file:entity.DescrizioneDAO.java
public static java.util.Iterator iterateDescrizioneByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Descrizione as Descrizione"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* ww w. j a va2s. 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.EContattoFactory.java
public static EContatto[] listEContattoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.EContatto as EContatto"); 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 om Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (EContatto[]) list.toArray(new EContatto[list.size()]); } catch (Exception e) { throw new PersistentException(e); } }
From source file:Entity.EContattoFactory.java
public static java.util.Iterator iterateEContattoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.EContatto as EContatto"); 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("this", lockMode); return query.iterate(); } catch (Exception e) { throw new PersistentException(e); } }
From source file:Entity.EGruppoFactory.java
public static EGruppo[] listEGruppoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.EGruppo as EGruppo"); 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. c om*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (EGruppo[]) list.toArray(new EGruppo[list.size()]); } catch (Exception e) { throw new PersistentException(e); } }
From source file:Entity.EGruppoFactory.java
public static java.util.Iterator iterateEGruppoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.EGruppo as EGruppo"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w w w . ja v a2 s .c om*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { throw new PersistentException(e); } }
From source file:entity.FilmDAO.java
public static Film[] listFilmByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Film as Film"); 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 (Film[]) list.toArray(new Film[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.FilmDAO.java
public static java.util.Iterator iterateFilmByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Film as Film"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w ww . j ava 2 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.FormatoDAO.java
public static Formato[] listFormatoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Formato as Formato"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w w w . j ava 2s . co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Formato[]) list.toArray(new Formato[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entity.FormatoDAO.java
public static java.util.Iterator iterateFormatoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Formato as Formato"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w ww .ja v 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.FornitoreDAO.java
public static Fornitore[] listFornitoreByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Fornitore as Fornitore"); 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 a 2s.co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Fornitore[]) list.toArray(new Fornitore[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }