Example usage for org.hibernate.annotations CacheConcurrencyStrategy NONE

List of usage examples for org.hibernate.annotations CacheConcurrencyStrategy NONE

Introduction

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

Prototype

CacheConcurrencyStrategy NONE

To view the source code for org.hibernate.annotations CacheConcurrencyStrategy NONE.

Click Source Link

Document

Indicates no concurrency strategy should be applied.

Usage

From source file:com.sybase365.mobiliser.custom.project.persistence.dao.hibernate.factory.MobiliserHibernateBeans.java

License:Apache License

@Override
public PersistenceClass[] getPersistenceClasses() {

    final List<PersistenceClass> lpc = new ArrayList<PersistenceClass>();

    // First add all bean classes that needs cache concurrency mode
    // read/write
    lpc.addAll(PersistenceClass.createBeans(new Class[] { Blacklist.class, BlacklistType.class },
            CacheConcurrencyStrategy.READ_WRITE));

    // Some persistence class instances are updated rarely therefore use
    // NONSTRICT_READ_WRITE
    lpc.addAll(PersistenceClass.createBeans(new Class[] {}, CacheConcurrencyStrategy.NONSTRICT_READ_WRITE));

    // special handling for non chached collection
    lpc.addAll(PersistenceClass.createBeans(new Class[] {}, CacheConcurrencyStrategy.NONSTRICT_READ_WRITE,
            CacheConcurrencyStrategy.NONE));

    lpc.addAll(PersistenceClass.createBeans(new Class[] {}, CacheConcurrencyStrategy.NONE));

    // Some persistence class instances are never updated. These can use
    // the concurrency strategy READ

    lpc.addAll(PersistenceClass.createBeans(new Class[] {}, CacheConcurrencyStrategy.READ_ONLY));

    // in case the superclass is already cached it is not allowed to set a
    // cache concurrency strategy on any children!!
    lpc.addAll(PersistenceClass.createBeans(new Class[] {}, null));

    return lpc.toArray(new PersistenceClass[lpc.size()]);
}

From source file:org.faster.orm.service.hibernate.HibernateDaoSupport.java

License:Open Source License

@SuppressWarnings("unchecked")
public HibernateDaoSupport() {
    persistClass = getPersistClass();//from ww  w .  j a  v a2  s .  com
    if (persistClass == null) {
        Type genericSuperClass = getClass().getGenericSuperclass();
        if (getClass().getName().contains("$$EnhancerBy")) {
            genericSuperClass = getClass().getSuperclass().getGenericSuperclass();
        }
        persistClass = (Class<PO>) ((ParameterizedType) genericSuperClass).getActualTypeArguments()[0];
    }
    Cache cache = persistClass.getAnnotation(Cache.class);
    cacheEnabled = cache != null && cache.usage() != CacheConcurrencyStrategy.NONE;
    persistClassName = persistClass.getSimpleName();
    parsePersistentFields();
}