Example usage for org.hibernate.annotations CacheConcurrencyStrategy READ_ONLY

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

Introduction

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

Prototype

CacheConcurrencyStrategy READ_ONLY

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

Click Source Link

Document

Indicates that read-only 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()]);
}