Search in sources :

Example 1 with CachedDomainDataAccess

use of org.hibernate.cache.spi.access.CachedDomainDataAccess in project infinispan by infinispan.

the class CorrectnessTestCase method getPutFromLoadValidator.

private PutFromLoadValidator getPutFromLoadValidator(SessionFactoryImplementor sfi, String regionName) throws NoSuchFieldException, IllegalAccessException {
    // TODO not sure if this is correct.
    CachedDomainDataAccess strategy = sfi.getMetamodel().entityPersister(Family.class).getCacheAccessStrategy();
    if (strategy == null) {
        return null;
    }
    Field delegateField = getField(strategy.getClass(), "delegate");
    Object delegate = delegateField.get(strategy);
    if (delegate == null) {
        return null;
    }
    if (InvalidationCacheAccessDelegate.class.isInstance(delegate)) {
        Field validatorField = InvalidationCacheAccessDelegate.class.getDeclaredField("putValidator");
        validatorField.setAccessible(true);
        return (PutFromLoadValidator) validatorField.get(delegate);
    } else {
        return null;
    }
}
Also used : CachedDomainDataAccess(org.hibernate.cache.spi.access.CachedDomainDataAccess) Field(java.lang.reflect.Field) PutFromLoadValidator(org.infinispan.hibernate.cache.commons.access.PutFromLoadValidator) Family(org.infinispan.test.hibernate.cache.commons.stress.entities.Family)

Aggregations

Field (java.lang.reflect.Field)1 CachedDomainDataAccess (org.hibernate.cache.spi.access.CachedDomainDataAccess)1 PutFromLoadValidator (org.infinispan.hibernate.cache.commons.access.PutFromLoadValidator)1 Family (org.infinispan.test.hibernate.cache.commons.stress.entities.Family)1