Example usage for org.hibernate LockMode UPGRADE

List of usage examples for org.hibernate LockMode UPGRADE

Introduction

In this page you can find the example usage for org.hibernate LockMode UPGRADE.

Prototype

LockMode UPGRADE

To view the source code for org.hibernate LockMode UPGRADE.

Click Source Link

Document

An upgrade lock.

Usage

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public void lockPessimistically(Object entity) {
    session.lock(entity, LockMode.UPGRADE);
}

From source file:org.libreplan.business.common.daos.GenericDAOHibernate.java

License:Open Source License

public void lock(E entity) {
    // TODO resolve deprecated
    getSession().lock(entity, LockMode.UPGRADE);

}

From source file:org.mifos.framework.util.helpers.TestObjectFactory.java

License:Open Source License

private static void deleteProductMix(final ProductMixBO prdmix) {
    Session session = StaticHibernateUtil.getSessionTL();
    session.lock(prdmix, LockMode.UPGRADE);
    Transaction transaction = StaticHibernateUtil.startTransaction();
    session.delete(prdmix);//  w w w .  j  a  va  2  s.co  m
    session.flush();
}

From source file:org.mifos.framework.util.helpers.TestObjectFactory.java

License:Open Source License

private static void deleteSavingProduct(final SavingsOfferingBO savingPrdBO) {
    Session session = StaticHibernateUtil.getSessionTL();
    session.lock(savingPrdBO, LockMode.UPGRADE);
    Transaction transaction = StaticHibernateUtil.startTransaction();
    session.delete(savingPrdBO);/*from   w  w  w.  ja  v  a 2  s  .c o  m*/
    session.flush();
}

From source file:org.olat.resource.lock.pessimistic.PessimisticLockManager.java

License:Apache License

private PLock findPLock(final String asset) {
    final DBQuery q = DBFactory.getInstance().createQuery(
            "select plock from org.olat.resource.lock.pessimistic.PLockImpl as plock where plock.asset = :asset");
    q.setParameter("asset", asset);
    q.setLockMode("plock", LockMode.UPGRADE);
    final List res = q.list();
    if (res.size() == 0) {
        return null;
    } else {//from w w  w. j  a  v  a 2 s.  c o  m
        return (PLock) res.get(0);
    }
}

From source file:org.openebiz.dao.common.cac.RoadTransportTypeDAOImpl.java

public void delete(RoadTransportType value) {
    Session session = getSession();//from  w w  w  .  jav  a  2s .  com
    session.refresh(value, LockMode.UPGRADE);
    session.delete(value);
    if (log.isDebugEnabled())
        log.debug("deleting document: " + value);
}

From source file:org.openebiz.dao.common.cac.RoadTransportTypeDAOImpl.java

public void delete(Long id) {
    RoadTransportType value = getById(id);
    Session session = getSession();/*from w  w  w. j a  va  2 s. c  o  m*/
    if (value != null) {
        session.refresh(value, LockMode.UPGRADE);
        session.delete(value);
        if (log.isDebugEnabled())
            log.debug("deleting document: " + value + " by ID:" + id);
    }
}

From source file:org.openebiz.dao.common.cbc.LicensePlateIDTypeDAOImpl.java

License:Open Source License

public void delete(LicensePlateIDType value) {
    Session session = getSession();//from ww  w.j a v  a2  s.  c o  m
    session.refresh(value, LockMode.UPGRADE);
    session.delete(value);
    if (log.isDebugEnabled())
        log.debug("deleting document: " + value);
}

From source file:org.openebiz.dao.common.cbc.LicensePlateIDTypeDAOImpl.java

License:Open Source License

public void delete(Long id) {
    LicensePlateIDType value = getById(id);
    Session session = getSession();// w  w w  .  j  a  v  a 2s .  c  o m
    if (value != null) {
        session.refresh(value, LockMode.UPGRADE);
        session.delete(value);
        if (log.isDebugEnabled())
            log.debug("deleting document: " + value + " by ID:" + id);
    }
}

From source file:org.openehealth.ipf.commons.flow.repository.FlowRepositoryImpl.java

License:Apache License

@Override
public Flow lock(Long id) {
    try {/*from   w ww. ja  va2s  .c  o m*/
        return (Flow) getHibernateTemplate().load(Flow.class, id, LockMode.UPGRADE);
    } catch (HibernateObjectRetrievalFailureException e) {
        throw new FlowException("no flow with id " + id);
    }
}