Skip to content

Commit

Permalink
support for hibernate version 5.0.1.Final
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaicostin committed Apr 15, 2017
1 parent 8931e41 commit e6830cf
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 108 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.mihaicostin</groupId>
<artifactId>hibernate-l2-memcached</artifactId>
<version>5.2.1.0</version>
<version>5.0.1.0</version>
<name>hibernate-l2-memcached</name>
<description>A library for using Memcached as a second level distributed cache in Hibernate.</description>
<url>https://github.com/mihaicostin/hibernate-l2-memcached</url>
Expand Down Expand Up @@ -39,7 +39,7 @@
</distributionManagement>

<properties>
<hibernate-core.version>5.2.1.Final</hibernate-core.version>
<hibernate-core.version>5.0.1.Final</hibernate-core.version>
<spymemcached.version>2.12.1</spymemcached.version>
<slf4j-api.version>1.5.6</slf4j-api.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.mc.hibernate.memcached.MemcachedCache;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.QueryResultsRegion;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -31,12 +31,12 @@ public MemcachedQueryResultsRegion(MemcachedCache cache) {
}

@Override
public Object get(SharedSessionContractImplementor session, Object key) throws CacheException {
public Object get(SessionImplementor session, Object key) throws CacheException {
return cache.get(key);
}

@Override
public void put(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
public void put(SessionImplementor session, Object key, Object value) throws CacheException {
cache.put(key, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.mc.hibernate.memcached.MemcachedCache;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.TimestampsRegion;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -31,12 +31,12 @@ public MemcachedTimestampsRegion(MemcachedCache cache) {
}

@Override
public Object get(SharedSessionContractImplementor session, Object key) throws CacheException {
public Object get(SessionImplementor session, Object key) throws CacheException {
return cache.get(key);
}

@Override
public void put(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
public void put(SessionImplementor session, Object key, Object value) throws CacheException {
cache.put(key, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import com.mc.hibernate.memcached.region.AbstractMemcachedRegion;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;

public abstract class AbstractMemcachedAccessStrategy<T extends AbstractMemcachedRegion> {

Expand Down Expand Up @@ -49,15 +48,15 @@ protected SessionFactoryOptions settings() {
* This method is a placeholder for method signatures supplied by interfaces pulled in further down the class
* hierarchy.
*/
public final boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version) throws CacheException {
public final boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version) throws CacheException {
return putFromLoad(session, key, value, txTimestamp, version, settings.isMinimalPutsEnabled());
}

/**
* This method is a placeholder for method signatures supplied by interfaces pulled in further down the class
* hierarchy.
*/
public abstract boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
public abstract boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
throws CacheException;

/**
Expand All @@ -82,7 +81,7 @@ public void unlockRegion(SoftLock lock) throws CacheException {
/**
* A no-op since this is an asynchronous cache access strategy.
*/
public void remove(SharedSessionContractImplementor session, Object key) throws CacheException {
public void remove(SessionImplementor session, Object key) throws CacheException {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -50,7 +50,7 @@ public AbstractReadWriteMemcachedAccessStrategy(T region, SessionFactoryOptions
* Returns <code>null</code> if the item is not readable. Locked items are not readable, nor are items created
* afterQuery the start of this transaction.
*/
public final Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
public final Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
readLockIfNeeded(key);
try {
final Lockable item = (Lockable) region().get(key);
Expand All @@ -72,7 +72,7 @@ public final Object get(SharedSessionContractImplementor session, Object key, lo
*/
@Override
public final boolean putFromLoad(
SharedSessionContractImplementor session,
SessionImplementor session,
Object key,
Object value,
long txTimestamp,
Expand All @@ -98,7 +98,7 @@ public final boolean putFromLoad(
/**
* Soft-lock a cache item.
*/
public final SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
public final SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
region.getCache().lock(key);
try {
final Lockable item = (Lockable) region().get(key);
Expand All @@ -118,7 +118,7 @@ public final SoftLock lockItem(SharedSessionContractImplementor session, Object
/**
* Soft-unlock a cache item.
*/
public final void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
public final void unlockItem(SessionImplementor session, Object key, SoftLock lock) throws CacheException {
region.getCache().lock(key);
try {
final Lockable item = (Lockable) region().get(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.internal.DefaultCacheKeysFactory;
import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.persister.collection.CollectionPersister;

public class NonStrictReadWriteMemcachedCollectionRegionAccessStrategy
Expand All @@ -35,12 +34,12 @@ public NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(MemcachedCollec
}

@Override
public Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
public Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
return null;
}

@Override
public final boolean putFromLoad(SharedSessionContractImplementor session,
public final boolean putFromLoad(SessionImplementor session,
Object key,
Object value,
long txTimestamp,
Expand All @@ -55,12 +54,12 @@ public final boolean putFromLoad(SharedSessionContractImplementor session,
}

@Override
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
public SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
return null;
}

@Override
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
public void unlockItem(SessionImplementor session, Object key, SoftLock lock) throws CacheException {
region().remove(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.persister.entity.EntityPersister;

/**
Expand All @@ -44,12 +44,12 @@ public NonStrictReadWriteMemcachedEntityRegionAccessStrategy(MemcachedEntityRegi


@Override
public Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
public Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
return region().get(key);
}

@Override
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
public boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
throws CacheException {
if (minimalPutOverride && region.contains(key)) {
return false;
Expand All @@ -65,7 +65,7 @@ public boolean putFromLoad(SharedSessionContractImplementor session, Object key,
* Since this is a non-strict read/write strategy item locking is not used.
*/
@Override
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
public SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
return null;
}

Expand All @@ -75,7 +75,7 @@ public SoftLock lockItem(SharedSessionContractImplementor session, Object key, O
* Since this is a non-strict read/write strategy item locking is not used.
*/
@Override
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
public void unlockItem(SessionImplementor session, Object key, SoftLock lock) throws CacheException {
region().remove(key);
}

Expand All @@ -85,7 +85,7 @@ public void unlockItem(SharedSessionContractImplementor session, Object key, Sof
* Returns <code>false</code> since this is an asynchronous cache access strategy.
*/
@Override
public boolean insert(SharedSessionContractImplementor session, Object key, Object value, Object version) throws CacheException {
public boolean insert(SessionImplementor session, Object key, Object value, Object version) throws CacheException {
return false;
}

Expand All @@ -95,7 +95,7 @@ public boolean insert(SharedSessionContractImplementor session, Object key, Obje
* Returns <code>false</code> since this is a non-strict read/write cache access strategy
*/
@Override
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version) throws CacheException {
public boolean afterInsert(SessionImplementor session, Object key, Object value, Object version) throws CacheException {
return false;
}

Expand All @@ -105,21 +105,21 @@ public boolean afterInsert(SharedSessionContractImplementor session, Object key,
* Removes the entry since this is a non-strict read/write cache strategy.
*/
@Override
public boolean update(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion)
public boolean update(SessionImplementor session, Object key, Object value, Object currentVersion, Object previousVersion)
throws CacheException {
remove(session, key);
return false;
}

@Override
public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
public boolean afterUpdate(SessionImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
throws CacheException {
unlockItem(session, key, lock);
return false;
}

@Override
public void remove(SharedSessionContractImplementor session, Object key) throws CacheException {
public void remove(SessionImplementor session, Object key) throws CacheException {
region().remove(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.internal.DefaultCacheKeysFactory;
import org.hibernate.cache.spi.NaturalIdRegion;
import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.persister.entity.EntityPersister;


Expand All @@ -38,12 +37,12 @@ public NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy(MemcachedNatural
}

@Override
public Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
public Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
return region().get(key);
}

@Override
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
public boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
throws CacheException {
if (minimalPutOverride && region.contains(key)) {
return false;
Expand All @@ -59,7 +58,7 @@ public boolean putFromLoad(SharedSessionContractImplementor session, Object key,
* Since this is a non-strict read/write strategy item locking is not used.
*/
@Override
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
public SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
return null;
}

Expand All @@ -69,7 +68,7 @@ public SoftLock lockItem(SharedSessionContractImplementor session, Object key, O
* Since this is a non-strict read/write strategy item locking is not used.
*/
@Override
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
public void unlockItem(SessionImplementor session, Object key, SoftLock lock) throws CacheException {
region().remove(key);
}

Expand All @@ -79,7 +78,7 @@ public void unlockItem(SharedSessionContractImplementor session, Object key, Sof
* Returns <code>false</code> since this is an asynchronous cache access strategy.
*/
@Override
public boolean insert(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
public boolean insert(SessionImplementor session, Object key, Object value) throws CacheException {
return false;
}

Expand All @@ -89,7 +88,7 @@ public boolean insert(SharedSessionContractImplementor session, Object key, Obje
* Returns <code>false</code> since this is a non-strict read/write cache access strategy
*/
@Override
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
public boolean afterInsert(SessionImplementor session, Object key, Object value) throws CacheException {
return false;
}

Expand All @@ -99,24 +98,24 @@ public boolean afterInsert(SharedSessionContractImplementor session, Object key,
* Removes the entry since this is a non-strict read/write cache strategy.
*/
@Override
public boolean update(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
public boolean update(SessionImplementor session, Object key, Object value) throws CacheException {
remove(session, key);
return false;
}

@Override
public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock) throws CacheException {
public boolean afterUpdate(SessionImplementor session, Object key, Object value, SoftLock lock) throws CacheException {
unlockItem(session, key, lock);
return false;
}

@Override
public void remove(SharedSessionContractImplementor session, Object key) throws CacheException {
public void remove(SessionImplementor session, Object key) throws CacheException {
region().remove(key);
}

@Override
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session) {
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SessionImplementor session) {
return DefaultCacheKeysFactory.createNaturalIdKey(naturalIdValues, persister, session);
}

Expand Down
Loading

0 comments on commit e6830cf

Please sign in to comment.