Skip to content

Commit e6830cf

Browse files
committed
support for hibernate version 5.0.1.Final
1 parent 8931e41 commit e6830cf

16 files changed

+105
-108
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

4141
<properties>
42-
<hibernate-core.version>5.2.1.Final</hibernate-core.version>
42+
<hibernate-core.version>5.0.1.Final</hibernate-core.version>
4343
<spymemcached.version>2.12.1</spymemcached.version>
4444
<slf4j-api.version>1.5.6</slf4j-api.version>
4545

src/main/java/com/mc/hibernate/memcached/region/MemcachedQueryResultsRegion.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import com.mc.hibernate.memcached.MemcachedCache;
1919
import org.hibernate.cache.CacheException;
2020
import org.hibernate.cache.spi.QueryResultsRegion;
21-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
21+
import org.hibernate.engine.spi.SessionImplementor;
2222
import org.slf4j.Logger;
2323
import org.slf4j.LoggerFactory;
2424

@@ -31,12 +31,12 @@ public MemcachedQueryResultsRegion(MemcachedCache cache) {
3131
}
3232

3333
@Override
34-
public Object get(SharedSessionContractImplementor session, Object key) throws CacheException {
34+
public Object get(SessionImplementor session, Object key) throws CacheException {
3535
return cache.get(key);
3636
}
3737

3838
@Override
39-
public void put(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
39+
public void put(SessionImplementor session, Object key, Object value) throws CacheException {
4040
cache.put(key, value);
4141
}
4242

src/main/java/com/mc/hibernate/memcached/region/MemcachedTimestampsRegion.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import com.mc.hibernate.memcached.MemcachedCache;
1919
import org.hibernate.cache.CacheException;
2020
import org.hibernate.cache.spi.TimestampsRegion;
21-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
21+
import org.hibernate.engine.spi.SessionImplementor;
2222
import org.slf4j.Logger;
2323
import org.slf4j.LoggerFactory;
2424

@@ -31,12 +31,12 @@ public MemcachedTimestampsRegion(MemcachedCache cache) {
3131
}
3232

3333
@Override
34-
public Object get(SharedSessionContractImplementor session, Object key) throws CacheException {
34+
public Object get(SessionImplementor session, Object key) throws CacheException {
3535
return cache.get(key);
3636
}
3737

3838
@Override
39-
public void put(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
39+
public void put(SessionImplementor session, Object key, Object value) throws CacheException {
4040
cache.put(key, value);
4141
}
4242

src/main/java/com/mc/hibernate/memcached/strategy/AbstractMemcachedAccessStrategy.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
import com.mc.hibernate.memcached.region.AbstractMemcachedRegion;
2020
import org.hibernate.boot.spi.SessionFactoryOptions;
2121
import org.hibernate.cache.CacheException;
22-
import org.hibernate.cache.spi.CollectionRegion;
2322
import org.hibernate.cache.spi.access.SoftLock;
24-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
23+
import org.hibernate.engine.spi.SessionImplementor;
2524

2625
public abstract class AbstractMemcachedAccessStrategy<T extends AbstractMemcachedRegion> {
2726

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

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

6362
/**
@@ -82,7 +81,7 @@ public void unlockRegion(SoftLock lock) throws CacheException {
8281
/**
8382
* A no-op since this is an asynchronous cache access strategy.
8483
*/
85-
public void remove(SharedSessionContractImplementor session, Object key) throws CacheException {
84+
public void remove(SessionImplementor session, Object key) throws CacheException {
8685
}
8786

8887
/**

src/main/java/com/mc/hibernate/memcached/strategy/AbstractReadWriteMemcachedAccessStrategy.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.hibernate.cache.CacheException;
2121
import org.hibernate.cache.spi.CacheDataDescription;
2222
import org.hibernate.cache.spi.access.SoftLock;
23-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
23+
import org.hibernate.engine.spi.SessionImplementor;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626

@@ -50,7 +50,7 @@ public AbstractReadWriteMemcachedAccessStrategy(T region, SessionFactoryOptions
5050
* Returns <code>null</code> if the item is not readable. Locked items are not readable, nor are items created
5151
* afterQuery the start of this transaction.
5252
*/
53-
public final Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
53+
public final Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
5454
readLockIfNeeded(key);
5555
try {
5656
final Lockable item = (Lockable) region().get(key);
@@ -72,7 +72,7 @@ public final Object get(SharedSessionContractImplementor session, Object key, lo
7272
*/
7373
@Override
7474
public final boolean putFromLoad(
75-
SharedSessionContractImplementor session,
75+
SessionImplementor session,
7676
Object key,
7777
Object value,
7878
long txTimestamp,
@@ -98,7 +98,7 @@ public final boolean putFromLoad(
9898
/**
9999
* Soft-lock a cache item.
100100
*/
101-
public final SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
101+
public final SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
102102
region.getCache().lock(key);
103103
try {
104104
final Lockable item = (Lockable) region().get(key);
@@ -118,7 +118,7 @@ public final SoftLock lockItem(SharedSessionContractImplementor session, Object
118118
/**
119119
* Soft-unlock a cache item.
120120
*/
121-
public final void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
121+
public final void unlockItem(SessionImplementor session, Object key, SoftLock lock) throws CacheException {
122122
region.getCache().lock(key);
123123
try {
124124
final Lockable item = (Lockable) region().get(key);

src/main/java/com/mc/hibernate/memcached/strategy/NonStrictReadWriteMemcachedCollectionRegionAccessStrategy.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919
import org.hibernate.boot.spi.SessionFactoryOptions;
2020
import org.hibernate.cache.CacheException;
2121
import org.hibernate.cache.internal.DefaultCacheKeysFactory;
22-
import org.hibernate.cache.spi.CollectionRegion;
2322
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
2423
import org.hibernate.cache.spi.access.SoftLock;
2524
import org.hibernate.engine.spi.SessionFactoryImplementor;
26-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
25+
import org.hibernate.engine.spi.SessionImplementor;
2726
import org.hibernate.persister.collection.CollectionPersister;
2827

2928
public class NonStrictReadWriteMemcachedCollectionRegionAccessStrategy
@@ -35,12 +34,12 @@ public NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(MemcachedCollec
3534
}
3635

3736
@Override
38-
public Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
37+
public Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
3938
return null;
4039
}
4140

4241
@Override
43-
public final boolean putFromLoad(SharedSessionContractImplementor session,
42+
public final boolean putFromLoad(SessionImplementor session,
4443
Object key,
4544
Object value,
4645
long txTimestamp,
@@ -55,12 +54,12 @@ public final boolean putFromLoad(SharedSessionContractImplementor session,
5554
}
5655

5756
@Override
58-
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
57+
public SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
5958
return null;
6059
}
6160

6261
@Override
63-
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
62+
public void unlockItem(SessionImplementor session, Object key, SoftLock lock) throws CacheException {
6463
region().remove(key);
6564
}
6665

src/main/java/com/mc/hibernate/memcached/strategy/NonStrictReadWriteMemcachedEntityRegionAccessStrategy.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
2323
import org.hibernate.cache.spi.access.SoftLock;
2424
import org.hibernate.engine.spi.SessionFactoryImplementor;
25-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
25+
import org.hibernate.engine.spi.SessionImplementor;
2626
import org.hibernate.persister.entity.EntityPersister;
2727

2828
/**
@@ -44,12 +44,12 @@ public NonStrictReadWriteMemcachedEntityRegionAccessStrategy(MemcachedEntityRegi
4444

4545

4646
@Override
47-
public Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
47+
public Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
4848
return region().get(key);
4949
}
5050

5151
@Override
52-
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
52+
public boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
5353
throws CacheException {
5454
if (minimalPutOverride && region.contains(key)) {
5555
return false;
@@ -65,7 +65,7 @@ public boolean putFromLoad(SharedSessionContractImplementor session, Object key,
6565
* Since this is a non-strict read/write strategy item locking is not used.
6666
*/
6767
@Override
68-
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
68+
public SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
6969
return null;
7070
}
7171

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

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

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

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

114114
@Override
115-
public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
115+
public boolean afterUpdate(SessionImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
116116
throws CacheException {
117117
unlockItem(session, key, lock);
118118
return false;
119119
}
120120

121121
@Override
122-
public void remove(SharedSessionContractImplementor session, Object key) throws CacheException {
122+
public void remove(SessionImplementor session, Object key) throws CacheException {
123123
region().remove(key);
124124
}
125125

src/main/java/com/mc/hibernate/memcached/strategy/NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
import org.hibernate.boot.spi.SessionFactoryOptions;
2020
import org.hibernate.cache.CacheException;
2121
import org.hibernate.cache.internal.DefaultCacheKeysFactory;
22-
import org.hibernate.cache.spi.NaturalIdRegion;
2322
import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
2423
import org.hibernate.cache.spi.access.SoftLock;
25-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
24+
import org.hibernate.engine.spi.SessionImplementor;
2625
import org.hibernate.persister.entity.EntityPersister;
2726

2827

@@ -38,12 +37,12 @@ public NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy(MemcachedNatural
3837
}
3938

4039
@Override
41-
public Object get(SharedSessionContractImplementor session, Object key, long txTimestamp) throws CacheException {
40+
public Object get(SessionImplementor session, Object key, long txTimestamp) throws CacheException {
4241
return region().get(key);
4342
}
4443

4544
@Override
46-
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
45+
public boolean putFromLoad(SessionImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
4746
throws CacheException {
4847
if (minimalPutOverride && region.contains(key)) {
4948
return false;
@@ -59,7 +58,7 @@ public boolean putFromLoad(SharedSessionContractImplementor session, Object key,
5958
* Since this is a non-strict read/write strategy item locking is not used.
6059
*/
6160
@Override
62-
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
61+
public SoftLock lockItem(SessionImplementor session, Object key, Object version) throws CacheException {
6362
return null;
6463
}
6564

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

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

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

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

107106
@Override
108-
public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock) throws CacheException {
107+
public boolean afterUpdate(SessionImplementor session, Object key, Object value, SoftLock lock) throws CacheException {
109108
unlockItem(session, key, lock);
110109
return false;
111110
}
112111

113112
@Override
114-
public void remove(SharedSessionContractImplementor session, Object key) throws CacheException {
113+
public void remove(SessionImplementor session, Object key) throws CacheException {
115114
region().remove(key);
116115
}
117116

118117
@Override
119-
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session) {
118+
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SessionImplementor session) {
120119
return DefaultCacheKeysFactory.createNaturalIdKey(naturalIdValues, persister, session);
121120
}
122121

0 commit comments

Comments
 (0)