Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

HHH-7350 read-only entities can not be deleted from 2LC

  • Loading branch information...
commit a203ea65aa686510199d93102d48b5b6b7031151 1 parent 27df736
@stliu stliu authored
View
8 ...in/java/org/hibernate/cache/ehcache/internal/strategy/ReadOnlyEhcacheCollectionRegionAccessStrategy.java
@@ -75,19 +75,13 @@ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object ve
}
}
- /**
- * Throws UnsupportedOperationException since this cache is read-only
- *
- * @throws UnsupportedOperationException always
- */
public SoftLock lockItem(Object key, Object version) throws UnsupportedOperationException {
- throw new UnsupportedOperationException( "Can't write to a readonly object" );
+ return null;
}
/**
* A no-op since this cache is read-only
*/
public void unlockItem(Object key, SoftLock lock) throws CacheException {
- //throw new UnsupportedOperationException("Can't write to a readonly object");
}
}
View
9 ...c/main/java/org/hibernate/cache/ehcache/internal/strategy/ReadOnlyEhcacheEntityRegionAccessStrategy.java
@@ -78,20 +78,15 @@ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object ve
}
}
- /**
- * Throws UnsupportedOperationException since this cache is read-only
- *
- * @throws UnsupportedOperationException always
- */
public SoftLock lockItem(Object key, Object version) throws UnsupportedOperationException {
- throw new UnsupportedOperationException( "Can't write to a readonly object" );
+ return null;
}
/**
* A no-op since this cache is read-only
*/
public void unlockItem(Object key, SoftLock lock) throws CacheException {
- //throw new UnsupportedOperationException("Can't write to a readonly object");
+ evict( key );
}
/**
View
9 ...ain/java/org/hibernate/cache/ehcache/internal/strategy/ReadOnlyEhcacheNaturalIdRegionAccessStrategy.java
@@ -75,20 +75,15 @@ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object ve
}
}
- /**
- * Throws UnsupportedOperationException since this cache is read-only
- *
- * @throws UnsupportedOperationException always
- */
public SoftLock lockItem(Object key, Object version) throws UnsupportedOperationException {
- throw new UnsupportedOperationException( "Can't write to a readonly object" );
+ return null;
}
/**
* A no-op since this cache is read-only
*/
public void unlockItem(Object key, SoftLock lock) throws CacheException {
- //throw new UnsupportedOperationException("Can't write to a readonly object");
+ region.remove( key );
}
/**
View
19 hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/ReadOnlyAccess.java
@@ -16,25 +16,6 @@
super( naturalIdRegion );
}
- @Override
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- throw new UnsupportedOperationException( "Illegal attempt to edit read only item" );
- }
-
- @Override
- public SoftLock lockRegion() throws CacheException {
- throw new UnsupportedOperationException( "Illegal attempt to edit read only item" );
- }
-
- @Override
- public void unlockItem(Object key, SoftLock lock) throws CacheException {
- log.error( "Illegal attempt to edit read only item" );
- }
-
- @Override
- public void unlockRegion(SoftLock lock) throws CacheException {
- log.error( "Illegal attempt to edit read only item" );
- }
@Override
public boolean update(Object key, Object value) throws CacheException {
View
8 hibernate-testing/src/main/java/org/hibernate/testing/cache/BaseCollectionRegionAccessStrategy.java
@@ -31,7 +31,9 @@
*/
class BaseCollectionRegionAccessStrategy extends BaseRegionAccessStrategy implements CollectionRegionAccessStrategy {
private final CollectionRegionImpl region;
-
+ BaseCollectionRegionAccessStrategy(CollectionRegionImpl region) {
+ this.region = region;
+ }
@Override
protected BaseGeneralDataRegion getInternalRegion() {
return region;
@@ -46,8 +48,4 @@ protected boolean isDefaultMinimalPutOverride() {
public CollectionRegion getRegion() {
return region;
}
-
- BaseCollectionRegionAccessStrategy(CollectionRegionImpl region) {
- this.region = region;
- }
}
View
18 hibernate-testing/src/main/java/org/hibernate/testing/cache/ReadOnlyCollectionRegionAccessStrategy.java
@@ -33,25 +33,7 @@
* @author Strong Liu
*/
class ReadOnlyCollectionRegionAccessStrategy extends BaseCollectionRegionAccessStrategy {
- private static final CoreMessageLogger LOG = Logger.getMessageLogger(
- CoreMessageLogger.class, ReadOnlyCollectionRegionAccessStrategy.class.getName()
- );
-
ReadOnlyCollectionRegionAccessStrategy(CollectionRegionImpl region) {
super( region );
}
-
- @Override
- public void unlockItem(Object key, SoftLock lock) throws CacheException {
- LOG.invalidEditOfReadOnlyItem( key );
- }
-
- @Override
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- LOG.invalidEditOfReadOnlyItem( key );
- throw new UnsupportedOperationException( "Can't write to a readonly object" );
- }
-
-
-
}
View
11 hibernate-testing/src/main/java/org/hibernate/testing/cache/ReadOnlyEntityRegionAccessStrategy.java
@@ -54,18 +54,9 @@ public boolean afterInsert(Object key, Object value, Object version) throws Cach
return true;
}
- /**
- * This cache is asynchronous hence a no-op
- */
@Override
public void unlockItem(Object key, SoftLock lock) throws CacheException {
- LOG.invalidEditOfReadOnlyItem( key );
- }
-
- @Override
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- LOG.invalidEditOfReadOnlyItem( key );
- throw new UnsupportedOperationException( "Can't write to a readonly object" );
+ evict( key );
}
/**
View
11 hibernate-testing/src/main/java/org/hibernate/testing/cache/ReadOnlyNaturalIdRegionAccessStrategy.java
@@ -43,15 +43,6 @@
@Override
public void unlockItem(Object key, SoftLock lock) throws CacheException {
- LOG.invalidEditOfReadOnlyItem( key );
+ evict( key );
}
-
- @Override
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- LOG.invalidEditOfReadOnlyItem( key );
- throw new UnsupportedOperationException( "Can't write to a readonly object" );
- }
-
-
-
}
Please sign in to comment.
Something went wrong with that request. Please try again.