HHH-7509 NPE regression in second level cache
This commit is contained in:
parent
8e73bb056e
commit
fae0d3f498
|
@ -87,15 +87,18 @@ public class CacheKey implements Serializable {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if ( other == null ) {
|
||||
return false;
|
||||
}
|
||||
if ( this == other ) {
|
||||
return true;
|
||||
}
|
||||
if ( !(other instanceof CacheKey) || hashCode != other.hashCode()) {
|
||||
if ( hashCode != other.hashCode() || !( other instanceof CacheKey ) ) {
|
||||
//hashCode is part of this check since it is pre-calculated and hash must match for equals to be true
|
||||
return false;
|
||||
}
|
||||
CacheKey that = (CacheKey) other;
|
||||
return entityOrRoleName.equals( that.entityOrRoleName ) &&
|
||||
return EqualsHelper.equals( entityOrRoleName, that.entityOrRoleName ) &&
|
||||
type.isEqual( key, that.key ) &&
|
||||
EqualsHelper.equals( tenantId, that.tenantId );
|
||||
}
|
||||
|
|
|
@ -137,17 +137,20 @@ public class NaturalIdCacheKey implements Serializable {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if ( o == null ) {
|
||||
return false;
|
||||
}
|
||||
if ( this == o ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !(o instanceof NaturalIdCacheKey) || hashCode != o.hashCode() ) {
|
||||
|
||||
if ( hashCode != o.hashCode() || !( o instanceof NaturalIdCacheKey ) ) {
|
||||
//hashCode is part of this check since it is pre-calculated and hash must match for equals to be true
|
||||
return false;
|
||||
}
|
||||
|
||||
final NaturalIdCacheKey other = (NaturalIdCacheKey) o;
|
||||
return entityName.equals( other.entityName )
|
||||
return EqualsHelper.equals( entityName, other.entityName )
|
||||
&& EqualsHelper.equals( tenantId, other.tenantId )
|
||||
&& Arrays.deepEquals( this.naturalIdValues, other.naturalIdValues );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue