Example usage for org.hibernate.cache.cfg.spi CollectionDataCachingConfig getOwnerVersionComparator

List of usage examples for org.hibernate.cache.cfg.spi CollectionDataCachingConfig getOwnerVersionComparator

Introduction

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

Prototype

Comparator getOwnerVersionComparator();

Source Link

Document

The comparator to be used with the owning entity's version (if it has one).

Usage

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

License:LGPL

@Override
public CollectionDataAccess getCollectionDataAccess(NavigableRole collectionRole) {
    CollectionDataCachingConfig collectionConfig = findConfig(this.config.getCollectionCaching(),
            collectionRole);//w  w w. j  a  v a2 s .  c  o  m
    AccessType accessType = collectionConfig.getAccessType();
    AccessDelegate accessDelegate = createAccessDelegate(accessType,
            collectionConfig.getOwnerVersionComparator());
    return new CollectionDataAccessImpl(this, accessDelegate, accessType);
}

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;/* w  ww.  j ava2 s  .  co  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;
}