List of usage examples for org.hibernate Query setLockMode
Query<R> setLockMode(String alias, LockMode lockMode);
From source file:edu.mgupi.pass.db.surfaces.MaterialsFactory.java
public static java.util.Iterator iterateMaterialsByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.Materials as Materials"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w ww . ja v a2 s .c o m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateMaterialsByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:edu.mgupi.pass.db.surfaces.SurfaceClassesFactory.java
public static SurfaceClasses[] listSurfaceClassesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.SurfaceClasses as SurfaceClasses"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* ww w . ja v a2 s . c om*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (SurfaceClasses[]) list.toArray(new SurfaceClasses[list.size()]); } catch (Exception e) { _logger.error("listSurfaceClassesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:edu.mgupi.pass.db.surfaces.SurfaceClassesFactory.java
public static java.util.Iterator iterateSurfaceClassesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.SurfaceClasses as SurfaceClasses"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {// 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( "iterateSurfaceClassesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:edu.mgupi.pass.db.surfaces.SurfacesFactory.java
public static Surfaces[] listSurfacesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.Surfaces as Surfaces"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {// w w w . j av a2 s .c o m Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (Surfaces[]) list.toArray(new Surfaces[list.size()]); } catch (Exception e) { _logger.error("listSurfacesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:edu.mgupi.pass.db.surfaces.SurfacesFactory.java
public static java.util.Iterator iterateSurfacesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.Surfaces as Surfaces"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w ww .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("iterateSurfacesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:edu.mgupi.pass.db.surfaces.SurfaceTypesFactory.java
public static SurfaceTypes[] listSurfaceTypesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.SurfaceTypes as SurfaceTypes"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/*from w ww.jav a2 s.co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); List list = query.list(); return (SurfaceTypes[]) list.toArray(new SurfaceTypes[list.size()]); } catch (Exception e) { _logger.error("listSurfaceTypesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:edu.mgupi.pass.db.surfaces.SurfaceTypesFactory.java
public static java.util.Iterator iterateSurfaceTypesByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.surfaces.SurfaceTypes as SurfaceTypes"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {/* w w w. ja va 2 s . co m*/ Query query = session.createQuery(sb.toString()); query.setLockMode("this", lockMode); return query.iterate(); } catch (Exception e) { _logger.error("iterateSurfaceTypesByQuery(PersistentSession session, String condition, String orderBy)", e); throw new PersistentException(e); } }
From source file:entities.Candidate.java
public static List queryCandidate(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entities.Candidate as Candidate"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w ww . j a v a 2 s. c o m Query query = session.createQuery(sb.toString()); query.setLockMode("Candidate", lockMode); return query.list(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entities.Candidate.java
public static java.util.Iterator iterateCandidateByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entities.Candidate as Candidate"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try {//from w w w . j a va 2 s. c om Query query = session.createQuery(sb.toString()); query.setLockMode("Candidate", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }
From source file:entities.County.java
public static List queryCounty(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entities.County as County"); 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 .c om*/ Query query = session.createQuery(sb.toString()); query.setLockMode("County", lockMode); return query.list(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } }