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.CommessaDAOImpl.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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