-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-15500 Cache key is huge since migration to 6
- Loading branch information
Showing
52 changed files
with
565 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...rnate-core/src/main/java/org/hibernate/cache/internal/DefaultCacheKeyValueDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.cache.internal; | ||
|
||
import java.util.Objects; | ||
|
||
public class DefaultCacheKeyValueDescriptor implements CacheKeyValueDescriptor { | ||
public static final DefaultCacheKeyValueDescriptor INSTANCE = new DefaultCacheKeyValueDescriptor(); | ||
|
||
@Override | ||
public int getHashCode(Object key) { | ||
return key.hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean isEqual(Object key1, Object key2) { | ||
return Objects.equals( key1, key2 ); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...nate-core/src/main/java/org/hibernate/cache/internal/JavaTypeCacheKeyValueDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.cache.internal; | ||
|
||
import org.hibernate.type.descriptor.java.JavaType; | ||
|
||
public class JavaTypeCacheKeyValueDescriptor implements CacheKeyValueDescriptor { | ||
private final JavaType<Object> javaType; | ||
|
||
public JavaTypeCacheKeyValueDescriptor(JavaType<?> javaType) { | ||
//noinspection unchecked | ||
this.javaType = (JavaType<Object>) javaType; | ||
} | ||
|
||
@Override | ||
public int getHashCode(Object key) { | ||
return javaType.extractHashCode( key ); | ||
} | ||
|
||
@Override | ||
public boolean isEqual(Object key1, Object key2) { | ||
return javaType.areEqual( key1, key2 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...re/src/main/java/org/hibernate/type/descriptor/java/BigNumberCacheKeyValueDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.type.descriptor.java; | ||
|
||
import org.hibernate.cache.internal.CacheKeyValueDescriptor; | ||
|
||
final class BigNumberCacheKeyValueDescriptor implements CacheKeyValueDescriptor { | ||
static final BigNumberCacheKeyValueDescriptor INSTANCE = new BigNumberCacheKeyValueDescriptor(); | ||
|
||
@Override | ||
public int getHashCode(Object key) { | ||
return ( (Number) key ).intValue(); | ||
} | ||
|
||
@Override | ||
public boolean isEqual(Object key1, Object key2) { | ||
//noinspection unchecked | ||
return ( key1 == key2 ) || ( key1 != null && key2 != null && ( (Comparable<Object>) key1 ).compareTo( key2 ) == 0 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.