Example usage for org.hibernate.cache.cfg.spi EntityDataCachingConfig isVersioned

List of usage examples for org.hibernate.cache.cfg.spi EntityDataCachingConfig isVersioned

Introduction

In this page you can find the example usage for org.hibernate.cache.cfg.spi EntityDataCachingConfig isVersioned.

Prototype

boolean isVersioned();

Source Link

Document

Mainly here to allow optimization of not having to know the actual comparator instance to use here yet.

Usage

From source file:org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl.java

License:LGPL

@Override
public EntityDataAccess getEntityDataAccess(NavigableRole rootEntityRole) {
    EntityDataCachingConfig entityConfig = findConfig(config.getEntityCaching(), rootEntityRole);
    AccessType accessType = entityConfig.getAccessType();
    AccessDelegate accessDelegate = createAccessDelegate(accessType,
            entityConfig.isVersioned() ? entityConfig.getVersionComparatorAccess().get() : null);
    if (accessType == AccessType.READ_ONLY || !entityConfig.isMutable()) {
        return new ReadOnlyEntityDataAccess(accessType, accessDelegate, this);
    } else {//w  ww  .  j a v  a  2  s  .  co m
        return new ReadWriteEntityDataAccess(accessType, accessDelegate, this);
    }
}

From source file:org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl.java

License:LGPL

private void prepareForVersionedEntries(CacheMode cacheMode) {
    if (strategy != null) {
        assert strategy == Strategy.VERSIONED_ENTRIES;
        return;//www  .jav  a2 s .  c o m
    }

    prepareCommon(cacheMode);
    filter = VersionedEntry.EXCLUDE_EMPTY_VERSIONED_ENTRY;

    for (EntityDataCachingConfig entityConfig : config.getEntityCaching()) {
        if (entityConfig.isVersioned()) {
            for (NavigableRole role : entityConfig.getCachedTypes()) {
                comparatorsByType.put(role.getNavigableName(), entityConfig.getVersionComparatorAccess().get());
            }
        }
    }
    for (CollectionDataCachingConfig collectionConfig : config.getCollectionCaching()) {
        if (collectionConfig.isVersioned()) {
            comparatorsByType.put(collectionConfig.getNavigableRole().getNavigableName(),
                    collectionConfig.getOwnerVersionComparator());
        }
    }

    strategy = Strategy.VERSIONED_ENTRIES;
}