Example usage for org.hibernate LockMode NONE

List of usage examples for org.hibernate LockMode NONE

Introduction

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

Prototype

LockMode NONE

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

Click Source Link

Document

No lock required.

Usage

From source file:com.bitranger.parknshop.common.dao.impl.PsItemDAO.java

License:Open Source License

public void attachClean(PsItem instance) {
    log.debug("attaching clean PsItem instance");
    try {//from  w  w  w .  j  a  v a 2s .  c o m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.common.dao.PsConfigKeyDAO.java

License:Open Source License

public void attachClean(PsConfigKey instance) {
    log.debug("attaching clean PsConfigKey instance");
    try {//from   www. j  a  v a  2 s . c o  m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.common.dao.PsConfigValDAO.java

License:Open Source License

public void attachClean(PsConfigVal instance) {
    log.debug("attaching clean PsConfigVal instance");
    try {//from  w  ww.  j  a v a2s .  c  o m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.seller.dao.impl.PsOrderDAO.java

License:Open Source License

public void attachClean(PsOrder instance) {
    log.debug("attaching clean PsOrder instance");
    try {/*www. j  a  v  a2s .  c om*/
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.seller.dao.PsNoticeSellerDAO.java

License:Open Source License

public void attachClean(PsNoticeSeller instance) {
    log.debug("attaching clean PsNoticeSeller instance");
    try {//from ww w .ja va2s . co m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.seller.dao.PsOrderLogDAO.java

License:Open Source License

public void attachClean(PsOrderLog instance) {
    log.debug("attaching clean PsOrderLog instance");
    try {// w  w w  .  j  a  v  a  2 s . c o  m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.seller.dao.PsShopApplyDAO.java

License:Open Source License

public void attachClean(PsShopApply instance) {
    log.debug("attaching clean PsShopApply instance");
    try {/*from  w w w.  j  a  v a  2 s . c  om*/
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.seller.PsSellerAccDAO.java

License:Open Source License

public void attachClean(PsSellerAcc instance) {
    log.debug("attaching clean PsSellerAcc instance");
    try {//from   ww  w  .  ja  v  a 2s. c o  m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.bitranger.parknshop.seller.PsSellerDAO.java

License:Open Source License

public void attachClean(PsSeller instance) {
    log.debug("attaching clean PsSeller instance");
    try {//from w w w .  j  a v  a  2s  . c o  m
        getHibernateTemplate().lock(instance, LockMode.NONE);
        log.debug("attach successful");
    } catch (RuntimeException re) {
        log.error("attach failed", re);
        throw re;
    }
}

From source file:com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.java

License:Apache License

private QueryParamEntry createQueryParameters(EntityManager em, List<Query> participatingQueries,
        List<String> queryStrings, Set<String> querySpaces) {
    List<ParameterSpecification> parameterSpecifications = new ArrayList<ParameterSpecification>();

    List<Type> types = new ArrayList<Type>();
    List<Object> values = new ArrayList<Object>();
    Map<String, TypedValue> namedParams = new LinkedHashMap<String, TypedValue>();
    Serializable collectionKey = null;
    LockOptions lockOptions = new LockOptions();
    RowSelection rowSelection = new RowSelection();
    boolean readOnly = false; // TODO: readonly?
    boolean cacheable = false; // TODO: cacheable?
    String cacheRegion = null;//from ww  w. ja  va 2 s . c  o  m
    String comment = null;
    List<String> queryHints = null;

    for (QueryParamEntry queryParamEntry : getQueryParamEntries(em, participatingQueries, querySpaces)) {
        queryStrings.add(queryParamEntry.queryString);

        QueryParameters participatingQueryParameters = queryParamEntry.queryParameters;
        // Merge parameters
        Collections.addAll(types, participatingQueryParameters.getPositionalParameterTypes());
        Collections.addAll(values, participatingQueryParameters.getPositionalParameterValues());
        namedParams.putAll(participatingQueryParameters.getNamedParameters());
        parameterSpecifications.addAll(queryParamEntry.specifications);

        // Merge row selections
        if (participatingQueryParameters.hasRowSelection()) {
            RowSelection original = queryParamEntry.queryParameters.getRowSelection();
            // Check for defaults

            /***************************************************************************
             * TODO: Either we do it like this, or let these values be passed in separately
             **************************************************************************/

            if (rowSelection.getFirstRow() == null || rowSelection.getFirstRow() < 1) {
                rowSelection.setFirstRow(original.getFirstRow());
            } else if (original.getFirstRow() != null && original.getFirstRow() > 0
                    && !original.getFirstRow().equals(rowSelection.getFirstRow())) {
                throw new IllegalStateException("Multiple row selections not allowed!");
            }
            if (rowSelection.getMaxRows() == null || rowSelection.getMaxRows() == Integer.MAX_VALUE) {
                rowSelection.setMaxRows(original.getMaxRows());
            } else if (original.getMaxRows() != null && original.getMaxRows() != Integer.MAX_VALUE
                    && !original.getMaxRows().equals(rowSelection.getMaxRows())) {
                throw new IllegalStateException("Multiple row selections not allowed!");
            }

            if (rowSelection.getFetchSize() == null) {
                rowSelection.setFetchSize(original.getFetchSize());
            } else if (original.getFetchSize() != null
                    && !original.getFetchSize().equals(rowSelection.getFetchSize())) {
                throw new IllegalStateException("Multiple row selections not allowed!");
            }
            if (rowSelection.getTimeout() == null) {
                rowSelection.setTimeout(original.getTimeout());
            } else if (original.getTimeout() != null
                    && !original.getTimeout().equals(rowSelection.getTimeout())) {
                throw new IllegalStateException("Multiple row selections not allowed!");
            }
        }

        // Merge lock options
        LockOptions originalLockOptions = participatingQueryParameters.getLockOptions();
        if (originalLockOptions.getScope()) {
            lockOptions.setScope(true);
        }
        if (originalLockOptions.getLockMode() != LockMode.NONE) {
            if (lockOptions.getLockMode() != LockMode.NONE
                    && lockOptions.getLockMode() != originalLockOptions.getLockMode()) {
                throw new IllegalStateException("Multiple different lock modes!");
            }
            lockOptions.setLockMode(originalLockOptions.getLockMode());
        }
        if (originalLockOptions.getTimeOut() != -1) {
            if (lockOptions.getTimeOut() != -1
                    && lockOptions.getTimeOut() != originalLockOptions.getTimeOut()) {
                throw new IllegalStateException("Multiple different lock timeouts!");
            }
            lockOptions.setTimeOut(originalLockOptions.getTimeOut());
        }
        @SuppressWarnings("unchecked")
        Iterator<Map.Entry<String, LockMode>> aliasLockIter = participatingQueryParameters.getLockOptions()
                .getAliasLockIterator();
        while (aliasLockIter.hasNext()) {
            Map.Entry<String, LockMode> entry = aliasLockIter.next();
            lockOptions.setAliasSpecificLockMode(entry.getKey(), entry.getValue());
        }
    }

    QueryParameters queryParameters = hibernateAccess.createQueryParameters(
            types.toArray(new Type[types.size()]), values.toArray(new Object[values.size()]), namedParams,
            lockOptions, rowSelection, true, readOnly, cacheable, cacheRegion, comment, queryHints,
            collectionKey == null ? null : new Serializable[] { collectionKey });

    return new QueryParamEntry(null, queryParameters, parameterSpecifications);
}