Example usage for org.hibernate Query setLockMode

List of usage examples for org.hibernate Query setLockMode

Introduction

In this page you can find the example usage for org.hibernate Query setLockMode.

Prototype

Query<R> setLockMode(String alias, LockMode lockMode);

Source Link

Document

Set the LockMode to use for specific alias (as defined in the query's FROM clause).

Usage

From source file:com.coedil99.modello_di_dominio.impl.LavorazionePezzoDAOImpl.java

public List queryLavorazionePezzo(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From com.coedil99.modello_di_dominio.LavorazionePezzo as LavorazionePezzo");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from www  . java 2  s  . com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LavorazionePezzo", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.LavorazionePezzoDAOImpl.java

public java.util.Iterator iterateLavorazionePezzoByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From com.coedil99.modello_di_dominio.LavorazionePezzo as LavorazionePezzo");
    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  2s. c  o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LavorazionePezzo", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.OrdineDAOImpl.java

public List queryOrdine(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.Ordine as Ordine");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from ww w .j a  va  2  s.  c  o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ordine", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.OrdineDAOImpl.java

public java.util.Iterator iterateOrdineByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.Ordine as Ordine");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   ww w  . j a  v a  2s.  c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ordine", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.PezzoDAOImpl.java

public List queryPezzo(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.Pezzo as Pezzo");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*  w  ww . j a va 2s . c  o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Pezzo", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.PezzoDAOImpl.java

public java.util.Iterator iteratePezzoByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.Pezzo as Pezzo");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// w  ww  .  j  av  a  2 s.c o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Pezzo", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.RDADAOImpl.java

public List queryRDA(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.RDA as RDA");
    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 2s  .c o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("RDA", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.RDADAOImpl.java

public java.util.Iterator iterateRDAByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.RDA as RDA");
    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 2s .  com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("RDA", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.RigaDistintaDAOImpl.java

public List queryRigaDistinta(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.RigaDistinta as RigaDistinta");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   ww w .  j a va 2s .  co m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("RigaDistinta", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:com.coedil99.modello_di_dominio.impl.RigaDistintaDAOImpl.java

public java.util.Iterator iterateRigaDistintaByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From com.coedil99.modello_di_dominio.RigaDistinta as RigaDistinta");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from w w w  .j av  a2  s.  c  o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("RigaDistinta", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}