List of usage examples for org.hibernate Query setLockMode
Query<R> setLockMode(String alias, LockMode lockMode);
From source file:ma.massarpro.dao.impl.MessageDAOImpl.java
public Message[] listMessageByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Message as Message"); 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 om Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Message[]) list.toArray(new Message[list.size()]); } catch (Exception e) { _logger.error("listMessageByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.MessageDAOImpl.java
public static java.util.Iterator iterateMessageByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Message as Message"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from www . ja va 2 s .c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateMessageByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.NiveauDAOImpl.java
public Niveau[] listNiveauByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Niveau as Niveau"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*w w w . jav a 2s. c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Niveau[]) list.toArray(new Niveau[list.size()]); } catch (Exception e) { _logger.error("listNiveauByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.NiveauDAOImpl.java
public static java.util.Iterator iterateNiveauByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Niveau as Niveau"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* ww w . j a va 2s .c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateNiveauByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.NotesDAOImpl.java
public Notes[] listNotesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Notes as Notes"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w ww. j ava2s. c o m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Notes[]) list.toArray(new Notes[list.size()]); } catch (Exception e) { _logger.error("listNotesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.NotesDAOImpl.java
public static java.util.Iterator iterateNotesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Notes as Notes"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from www.j av a 2 s .co m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateNotesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.ParentDAOImpl.java
public Parent[] listParentByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Parent as Parent"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {// www.j a v a2 s . c o m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Parent[]) list.toArray(new Parent[list.size()]); } catch (Exception e) { _logger.error("listParentByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.ParentDAOImpl.java
public static java.util.Iterator iterateParentByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Parent as Parent"); 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. co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateParentByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.PersonneDAOImpl.java
public Personne[] listPersonneByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Personne as Personne"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* ww w . j a v a2s.co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Personne[]) list.toArray(new Personne[list.size()]); } catch (Exception e) { _logger.error("listPersonneByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }
From source file:ma.massarpro.dao.impl.PersonneDAOImpl.java
public static java.util.Iterator iteratePersonneByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) { StringBuffer sb = new StringBuffer("From ma.massarpro.beans.Personne as Personne"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* w w w .j a va 2s .c o m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iteratePersonneByQuery(PersistentSession session, String condition, String orderBy)", e); throw new RuntimeException(e); } }