HHH-15500 Cache key is huge since migration to 6
This commit is contained in:
parent
89a98f2dc7
commit
893e1b096e
|
@ -50,10 +50,19 @@ public final class CacheKeyImplementation implements Serializable {
|
||||||
final String tenantId,
|
final String tenantId,
|
||||||
final SessionFactoryImplementor factory) {
|
final SessionFactoryImplementor factory) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.cacheKeyValueDescriptor = type.toCacheKeyDescriptor( factory );
|
|
||||||
this.entityOrRoleName = entityOrRoleName;
|
this.entityOrRoleName = entityOrRoleName;
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
this.hashCode = calculateHashCode( );
|
final CacheKeyValueDescriptor cacheKeyValueDescriptor = type.toCacheKeyDescriptor( factory );
|
||||||
|
// Optimization for the very common case Integer/Long etc. which use the default cache key descriptor
|
||||||
|
// Doing this helps to avoid megamorphic call sites and reduces the cache key serialization size
|
||||||
|
if ( cacheKeyValueDescriptor == DefaultCacheKeyValueDescriptor.INSTANCE ) {
|
||||||
|
this.cacheKeyValueDescriptor = null;
|
||||||
|
this.hashCode = Objects.hashCode( id );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cacheKeyValueDescriptor = cacheKeyValueDescriptor;
|
||||||
|
this.hashCode = calculateHashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calculateHashCode() {
|
private int calculateHashCode() {
|
||||||
|
@ -74,14 +83,23 @@ public final class CacheKeyImplementation implements Serializable {
|
||||||
if ( this == other ) {
|
if ( this == other ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ( hashCode != other.hashCode() || !( other instanceof CacheKeyImplementation) ) {
|
if ( hashCode != other.hashCode() || !( other instanceof CacheKeyImplementation ) ) {
|
||||||
//hashCode is part of this check since it is pre-calculated and hash must match for equals to be true
|
//hashCode is part of this check since it is pre-calculated and hash must match for equals to be true
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final CacheKeyImplementation that = (CacheKeyImplementation) other;
|
final CacheKeyImplementation that = (CacheKeyImplementation) other;
|
||||||
return Objects.equals( entityOrRoleName, that.entityOrRoleName )
|
if ( !entityOrRoleName.equals( that.entityOrRoleName ) ) {
|
||||||
&& cacheKeyValueDescriptor.isEqual( id, that.id )
|
return false;
|
||||||
&& Objects.equals( tenantId, that.tenantId );
|
}
|
||||||
|
if ( cacheKeyValueDescriptor == null ) {
|
||||||
|
if ( !Objects.equals( id, that.id ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !cacheKeyValueDescriptor.isEqual( id, that.id ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals( tenantId, that.tenantId );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,14 +20,17 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
* @see CustomComponentCacheKeyValueDescriptor
|
* @see CustomComponentCacheKeyValueDescriptor
|
||||||
*/
|
*/
|
||||||
public class ComponentCacheKeyValueDescriptor implements CacheKeyValueDescriptor {
|
public class ComponentCacheKeyValueDescriptor implements CacheKeyValueDescriptor {
|
||||||
private final NavigableRole role;
|
private final String role;
|
||||||
private final SessionFactoryImplementor sessionFactory;
|
private final SessionFactoryImplementor sessionFactory;
|
||||||
|
|
||||||
private transient EmbeddableValuedModelPart embeddedMapping;
|
private transient EmbeddableValuedModelPart embeddedMapping;
|
||||||
|
|
||||||
public ComponentCacheKeyValueDescriptor(NavigableRole role, SessionFactoryImplementor sessionFactory) {
|
public ComponentCacheKeyValueDescriptor(
|
||||||
this.role = role;
|
EmbeddableValuedModelPart embeddedMapping,
|
||||||
|
SessionFactoryImplementor sessionFactory) {
|
||||||
|
this.role = embeddedMapping.getNavigableRole().getFullPath();
|
||||||
this.sessionFactory = sessionFactory;
|
this.sessionFactory = sessionFactory;
|
||||||
|
this.embeddedMapping = embeddedMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,10 +85,12 @@ public class ComponentCacheKeyValueDescriptor implements CacheKeyValueDescriptor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private EmbeddableValuedModelPart getEmbeddedMapping() {
|
private EmbeddableValuedModelPart getEmbeddedMapping() {
|
||||||
|
EmbeddableValuedModelPart embeddedMapping = this.embeddedMapping;
|
||||||
if ( embeddedMapping == null ) {
|
if ( embeddedMapping == null ) {
|
||||||
embeddedMapping = sessionFactory.getRuntimeMetamodels().getEmbedded( role );
|
this.embeddedMapping = embeddedMapping = sessionFactory.getRuntimeMetamodels().getEmbedded(
|
||||||
|
new NavigableRole( role )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return embeddedMapping;
|
return embeddedMapping;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,20 +6,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.cache.internal;
|
package org.hibernate.cache.internal;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
|
||||||
import org.hibernate.usertype.CompositeUserType;
|
import org.hibernate.usertype.CompositeUserType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CacheKeyValueDescriptor used to describe CompositeUserType mappings
|
* CacheKeyValueDescriptor used to describe CompositeUserType mappings
|
||||||
*/
|
*/
|
||||||
public class CustomComponentCacheKeyValueDescriptor implements CacheKeyValueDescriptor {
|
public class CustomComponentCacheKeyValueDescriptor implements CacheKeyValueDescriptor {
|
||||||
private final NavigableRole role;
|
|
||||||
private final CompositeUserType<Object> compositeUserType;
|
private final CompositeUserType<Object> compositeUserType;
|
||||||
|
|
||||||
public CustomComponentCacheKeyValueDescriptor(
|
public CustomComponentCacheKeyValueDescriptor(CompositeUserType<Object> compositeUserType) {
|
||||||
NavigableRole role,
|
|
||||||
CompositeUserType<Object> compositeUserType) {
|
|
||||||
this.role = role;
|
|
||||||
this.compositeUserType = compositeUserType;
|
this.compositeUserType = compositeUserType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +28,4 @@ public class CustomComponentCacheKeyValueDescriptor implements CacheKeyValueDesc
|
||||||
return compositeUserType.equals( key1, key2 );
|
return compositeUserType.equals( key1, key2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CustomComponentCacheKeyValueDescriptor(" + role + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
23
hibernate-core/src/main/java/org/hibernate/cache/internal/DefaultCacheKeyValueDescriptor.java
vendored
Normal file
23
hibernate-core/src/main/java/org/hibernate/cache/internal/DefaultCacheKeyValueDescriptor.java
vendored
Normal file
|
@ -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
hibernate-core/src/main/java/org/hibernate/cache/internal/JavaTypeCacheKeyValueDescriptor.java
vendored
Normal file
28
hibernate-core/src/main/java/org/hibernate/cache/internal/JavaTypeCacheKeyValueDescriptor.java
vendored
Normal file
|
@ -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 );
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,18 +60,12 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
* Base support for EmbeddableMappingType implementations
|
* Base support for EmbeddableMappingType implementations
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractEmbeddableMapping implements EmbeddableMappingType {
|
public abstract class AbstractEmbeddableMapping implements EmbeddableMappingType {
|
||||||
protected final SessionFactoryImplementor sessionFactory;
|
|
||||||
|
|
||||||
public AbstractEmbeddableMapping(MappingModelCreationProcess creationProcess) {
|
public AbstractEmbeddableMapping(MappingModelCreationProcess creationProcess) {
|
||||||
this( creationProcess.getCreationContext() );
|
this( creationProcess.getCreationContext() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractEmbeddableMapping(RuntimeModelCreationContext creationContext) {
|
public AbstractEmbeddableMapping(RuntimeModelCreationContext creationContext) {
|
||||||
this( creationContext.getSessionFactory() );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AbstractEmbeddableMapping(SessionFactoryImplementor sessionFactory) {
|
|
||||||
this.sessionFactory = sessionFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme
|
||||||
this.embeddableJtd = representationStrategy.getMappedJavaType();
|
this.embeddableJtd = representationStrategy.getMappedJavaType();
|
||||||
this.valueMapping = embeddedPartBuilder.apply( this );
|
this.valueMapping = embeddedPartBuilder.apply( this );
|
||||||
|
|
||||||
final ConfigurationService cs = sessionFactory.getServiceRegistry()
|
final ConfigurationService cs = creationContext.getSessionFactory().getServiceRegistry()
|
||||||
.getService(ConfigurationService.class);
|
.getService(ConfigurationService.class);
|
||||||
|
|
||||||
this.createEmptyCompositesEnabled = ConfigurationHelper.getBoolean(
|
this.createEmptyCompositesEnabled = ConfigurationHelper.getBoolean(
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class IdClassEmbeddable extends AbstractEmbeddableMapping implements Iden
|
||||||
this.idMapping = idMapping;
|
this.idMapping = idMapping;
|
||||||
this.virtualIdEmbeddable = virtualIdEmbeddable;
|
this.virtualIdEmbeddable = virtualIdEmbeddable;
|
||||||
|
|
||||||
this.javaType = sessionFactory.getTypeConfiguration()
|
this.javaType = creationProcess.getCreationContext().getSessionFactory().getTypeConfiguration()
|
||||||
.getJavaTypeRegistry()
|
.getJavaTypeRegistry()
|
||||||
.resolveManagedTypeDescriptor( idClassSource.getComponentClass() );
|
.resolveManagedTypeDescriptor( idClassSource.getComponentClass() );
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class IdClassEmbeddable extends AbstractEmbeddableMapping implements Iden
|
||||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||||
final Object id = representationStrategy.getInstantiator().instantiate(
|
final Object id = representationStrategy.getInstantiator().instantiate(
|
||||||
null,
|
null,
|
||||||
sessionFactory
|
session.getSessionFactory()
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<AttributeMapping> virtualIdAttribute = virtualIdEmbeddable.getAttributeMappings();
|
final List<AttributeMapping> virtualIdAttribute = virtualIdEmbeddable.getAttributeMappings();
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
|
||||||
private final CompositeUserType<Object> compositeUserType;
|
private final CompositeUserType<Object> compositeUserType;
|
||||||
|
|
||||||
private EmbeddableValuedModelPart mappingModelPart;
|
private EmbeddableValuedModelPart mappingModelPart;
|
||||||
private CacheKeyValueDescriptor cacheKeyValueDescriptor;
|
private transient CacheKeyValueDescriptor cacheKeyValueDescriptor;
|
||||||
|
|
||||||
public ComponentType(Component component, int[] originalPropertyOrder, MetadataBuildingContext buildingContext) {
|
public ComponentType(Component component, int[] originalPropertyOrder, MetadataBuildingContext buildingContext) {
|
||||||
this.componentClass = component.isDynamic()
|
this.componentClass = component.isDynamic()
|
||||||
|
@ -705,19 +705,15 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
CacheKeyValueDescriptor cacheKeyValueDescriptor = this.cacheKeyValueDescriptor;
|
||||||
if ( cacheKeyValueDescriptor == null ) {
|
if ( cacheKeyValueDescriptor == null ) {
|
||||||
if ( compositeUserType != null ) {
|
if ( compositeUserType != null ) {
|
||||||
cacheKeyValueDescriptor = new CustomComponentCacheKeyValueDescriptor(
|
cacheKeyValueDescriptor = new CustomComponentCacheKeyValueDescriptor( compositeUserType );
|
||||||
mappingModelPart.getNavigableRole(),
|
|
||||||
compositeUserType
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cacheKeyValueDescriptor = new ComponentCacheKeyValueDescriptor(
|
cacheKeyValueDescriptor = new ComponentCacheKeyValueDescriptor( mappingModelPart, sessionFactory );
|
||||||
mappingModelPart.getNavigableRole(),
|
|
||||||
sessionFactory
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
this.cacheKeyValueDescriptor = cacheKeyValueDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cacheKeyValueDescriptor;
|
return cacheKeyValueDescriptor;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
|
@ -66,6 +67,8 @@ public class CustomType<J>
|
||||||
private final ValueBinder<J> valueBinder;
|
private final ValueBinder<J> valueBinder;
|
||||||
private final JdbcLiteralFormatter<J> jdbcLiteralFormatter;
|
private final JdbcLiteralFormatter<J> jdbcLiteralFormatter;
|
||||||
|
|
||||||
|
private transient CacheKeyValueDescriptor cacheKeyValueDescriptor;
|
||||||
|
|
||||||
public CustomType(UserType<J> userType, TypeConfiguration typeConfiguration) throws MappingException {
|
public CustomType(UserType<J> userType, TypeConfiguration typeConfiguration) throws MappingException {
|
||||||
this( userType, ArrayHelper.EMPTY_STRING_ARRAY, typeConfiguration );
|
this( userType, ArrayHelper.EMPTY_STRING_ARRAY, typeConfiguration );
|
||||||
}
|
}
|
||||||
|
@ -388,4 +391,32 @@ public class CustomType<J>
|
||||||
public BasicValueConverter<J, Object> getValueConverter() {
|
public BasicValueConverter<J, Object> getValueConverter() {
|
||||||
return userType.getValueConverter();
|
return userType.getValueConverter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
CacheKeyValueDescriptor cacheKeyValueDescriptor = this.cacheKeyValueDescriptor;
|
||||||
|
if ( cacheKeyValueDescriptor == null ) {
|
||||||
|
this.cacheKeyValueDescriptor = cacheKeyValueDescriptor = new CustomTypeCacheKeyValueDescriptor( getUserType() );
|
||||||
|
}
|
||||||
|
return cacheKeyValueDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class CustomTypeCacheKeyValueDescriptor implements CacheKeyValueDescriptor {
|
||||||
|
private final UserType<Object> userType;
|
||||||
|
|
||||||
|
public CustomTypeCacheKeyValueDescriptor(UserType<?> userType) {
|
||||||
|
//noinspection unchecked
|
||||||
|
this.userType = (UserType<Object>) userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return userType.hashCode( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return userType.equals( key1, key2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
|
||||||
|
@ -44,6 +46,11 @@ public class BigDecimalJavaType extends AbstractClassJavaType<BigDecimal> {
|
||||||
return value.intValue();
|
return value.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return BigNumberCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <X> X unwrap(BigDecimal value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(BigDecimal value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
|
|
@ -10,7 +10,9 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
|
||||||
|
@ -46,6 +48,11 @@ public class BigIntegerJavaType extends AbstractClassJavaType<BigInteger> {
|
||||||
return one == another || ( one != null && another != null && one.compareTo( another ) == 0 );
|
return one == another || ( one != null && another != null && one.compareTo( another ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return BigNumberCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <X> X unwrap(BigInteger value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(BigInteger value, Class<X> type, WrapperOptions options) {
|
||||||
|
|
|
@ -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 );
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.type.descriptor.java;
|
package org.hibernate.type.descriptor.java;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -177,4 +180,9 @@ public class BooleanJavaType extends AbstractClassJavaType<Boolean> implements
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
|
@ -191,4 +194,9 @@ public class ByteJavaType extends AbstractClassJavaType<Byte>
|
||||||
Integer precision, Integer scale, SharedSessionContractImplementor session) {
|
Integer precision, Integer scale, SharedSessionContractImplementor session) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,9 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.compare.CalendarComparator;
|
import org.hibernate.internal.util.compare.CalendarComparator;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -28,6 +30,18 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
public class CalendarDateJavaType extends AbstractTemporalJavaType<Calendar> {
|
public class CalendarDateJavaType extends AbstractTemporalJavaType<Calendar> {
|
||||||
public static final CalendarDateJavaType INSTANCE = new CalendarDateJavaType();
|
public static final CalendarDateJavaType INSTANCE = new CalendarDateJavaType();
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Calendar) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Calendar) key1, (Calendar) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected CalendarDateJavaType() {
|
protected CalendarDateJavaType() {
|
||||||
super( Calendar.class, CalendarJavaType.CalendarMutabilityPlan.INSTANCE, CalendarComparator.INSTANCE );
|
super( Calendar.class, CalendarJavaType.CalendarMutabilityPlan.INSTANCE, CalendarComparator.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -93,6 +107,11 @@ public class CalendarDateJavaType extends AbstractTemporalJavaType<Calendar> {
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <X> X unwrap(Calendar value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Calendar value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
|
|
@ -14,7 +14,9 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.internal.util.compare.CalendarComparator;
|
import org.hibernate.internal.util.compare.CalendarComparator;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
@ -38,6 +40,18 @@ public class CalendarJavaType extends AbstractTemporalJavaType<Calendar> impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Calendar) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Calendar) key1, (Calendar) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected CalendarJavaType() {
|
protected CalendarJavaType() {
|
||||||
super( Calendar.class, CalendarMutabilityPlan.INSTANCE, CalendarComparator.INSTANCE );
|
super( Calendar.class, CalendarMutabilityPlan.INSTANCE, CalendarComparator.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -111,6 +125,11 @@ public class CalendarJavaType extends AbstractTemporalJavaType<Calendar> impleme
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <X> X unwrap(Calendar value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Calendar value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
|
|
@ -13,7 +13,9 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.compare.CalendarComparator;
|
import org.hibernate.internal.util.compare.CalendarComparator;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -28,6 +30,18 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
public class CalendarTimeJavaType extends AbstractTemporalJavaType<Calendar> {
|
public class CalendarTimeJavaType extends AbstractTemporalJavaType<Calendar> {
|
||||||
public static final CalendarTimeJavaType INSTANCE = new CalendarTimeJavaType();
|
public static final CalendarTimeJavaType INSTANCE = new CalendarTimeJavaType();
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Calendar) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Calendar) key1, (Calendar) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected CalendarTimeJavaType() {
|
protected CalendarTimeJavaType() {
|
||||||
super( Calendar.class, CalendarJavaType.CalendarMutabilityPlan.INSTANCE, CalendarComparator.INSTANCE );
|
super( Calendar.class, CalendarJavaType.CalendarMutabilityPlan.INSTANCE, CalendarComparator.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -93,6 +107,11 @@ public class CalendarTimeJavaType extends AbstractTemporalJavaType<Calendar> {
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <X> X unwrap(Calendar value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Calendar value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
package org.hibernate.type.descriptor.java;
|
package org.hibernate.type.descriptor.java;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -110,4 +113,9 @@ public class CharacterJavaType extends AbstractClassJavaType<Character> implemen
|
||||||
public int getDefaultSqlScale(Dialect dialect, JdbcType jdbcType) {
|
public int getDefaultSqlScale(Dialect dialect, JdbcType jdbcType) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* 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;
|
package org.hibernate.type.descriptor.java;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
|
||||||
|
@ -64,4 +68,9 @@ public class ClassJavaType extends AbstractClassJavaType<Class> {
|
||||||
}
|
}
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,10 @@ package org.hibernate.type.descriptor.java;
|
||||||
|
|
||||||
import java.util.Currency;
|
import java.util.Currency;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
|
||||||
|
@ -60,4 +63,9 @@ public class CurrencyJavaType extends AbstractClassJavaType<Currency> {
|
||||||
public long getDefaultSqlLength(Dialect dialect, JdbcType jdbcType) {
|
public long getDefaultSqlLength(Dialect dialect, JdbcType jdbcType) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,9 @@ import java.util.GregorianCalendar;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -41,6 +43,18 @@ public class DateJavaType extends AbstractTemporalJavaType<Date> implements Vers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Date) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Date) key1, (Date) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public DateJavaType() {
|
public DateJavaType() {
|
||||||
super( Date.class, DateMutabilityPlan.INSTANCE );
|
super( Date.class, DateMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -108,6 +122,11 @@ public class DateJavaType extends AbstractTemporalJavaType<Date> implements Vers
|
||||||
return CalendarJavaType.INSTANCE.extractHashCode( calendar );
|
return CalendarJavaType.INSTANCE.extractHashCode( calendar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||||
|
|
|
@ -14,7 +14,9 @@ import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
@ -256,4 +258,9 @@ public class DbTimestampJavaType<T> implements VersionJavaType<T>, TemporalJavaT
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
return delegate.resolveTypeForPrecision( precision, typeConfiguration );
|
return delegate.resolveTypeForPrecision( precision, typeConfiguration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return delegate.toCacheKeyDescriptor( sessionFactory );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,10 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.DoubleJdbcType;
|
import org.hibernate.type.descriptor.jdbc.DoubleJdbcType;
|
||||||
|
@ -208,4 +211,9 @@ public class DoubleJavaType extends AbstractClassJavaType<Double> implements
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ package org.hibernate.type.descriptor.java;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import jakarta.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -219,4 +222,9 @@ public class EnumJavaType<T extends Enum<T>> extends AbstractClassJavaType<T> {
|
||||||
public String getCheckCondition(String columnName, JdbcType jdbcType, Dialect dialect) {
|
public String getCheckCondition(String columnName, JdbcType jdbcType, Dialect dialect) {
|
||||||
return dialect.getEnumCheckCondition( columnName, jdbcType.getJdbcTypeCode(), getJavaTypeClass() );
|
return dialect.getEnumCheckCondition( columnName, jdbcType.getJdbcTypeCode(), getJavaTypeClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,10 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
|
@ -202,4 +205,9 @@ public class FloatJavaType extends AbstractClassJavaType<Float> implements Primi
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ package org.hibernate.type.descriptor.java;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -98,4 +101,9 @@ public class InetAddressJavaType extends AbstractClassJavaType<InetAddress> {
|
||||||
return 19;
|
return 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,10 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
@ -209,4 +212,9 @@ public class InstantJavaType extends AbstractTemporalJavaType<Instant>
|
||||||
return Instant.now( ClockHelper.forPrecision( precision, session ) );
|
return Instant.now( ClockHelper.forPrecision( precision, session ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,10 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
|
@ -209,4 +212,9 @@ public class IntegerJavaType extends AbstractClassJavaType<Integer>
|
||||||
return current + 1;
|
return current + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,13 @@ import java.lang.reflect.Type;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.JavaTypeCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.jdbc.Size;
|
import org.hibernate.engine.jdbc.Size;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.internal.util.compare.ComparableComparator;
|
import org.hibernate.internal.util.compare.ComparableComparator;
|
||||||
|
@ -274,4 +278,12 @@ public interface JavaType<T> extends Serializable {
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
return createJavaType( parameterizedType );
|
return createJavaType( parameterizedType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
if ( this instanceof CacheKeyValueDescriptor ) {
|
||||||
|
return (CacheKeyValueDescriptor) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JavaTypeCacheKeyValueDescriptor( this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -44,6 +46,18 @@ public class JdbcDateJavaType extends AbstractTemporalJavaType<Date> {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static final DateTimeFormatter LITERAL_FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE;
|
public static final DateTimeFormatter LITERAL_FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE;
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Date) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Date) key1, (Date) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public JdbcDateJavaType() {
|
public JdbcDateJavaType() {
|
||||||
super( java.sql.Date.class, DateMutabilityPlan.INSTANCE );
|
super( java.sql.Date.class, DateMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -95,6 +109,11 @@ public class JdbcDateJavaType extends AbstractTemporalJavaType<Date> {
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date coerce(Object value, CoercionContext coercionContext) {
|
public Date coerce(Object value, CoercionContext coercionContext) {
|
||||||
return wrap( value, null );
|
return wrap( value, null );
|
||||||
|
|
|
@ -17,7 +17,9 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -50,6 +52,18 @@ public class JdbcTimeJavaType extends AbstractTemporalJavaType<Date> {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static final DateTimeFormatter LOGGABLE_FORMATTER = DateTimeFormatter.ISO_LOCAL_TIME;
|
public static final DateTimeFormatter LOGGABLE_FORMATTER = DateTimeFormatter.ISO_LOCAL_TIME;
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Date) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Date) key1, (Date) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public JdbcTimeJavaType() {
|
public JdbcTimeJavaType() {
|
||||||
super( Time.class, TimeMutabilityPlan.INSTANCE );
|
super( Time.class, TimeMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -103,6 +117,11 @@ public class JdbcTimeJavaType extends AbstractTemporalJavaType<Date> {
|
||||||
&& calendar1.get( Calendar.MILLISECOND ) == calendar2.get( Calendar.MILLISECOND );
|
&& calendar1.get( Calendar.MILLISECOND ) == calendar2.get( Calendar.MILLISECOND );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date coerce(Object value, CoercionContext coercionContext) {
|
public Date coerce(Object value, CoercionContext coercionContext) {
|
||||||
return wrap( value, null );
|
return wrap( value, null );
|
||||||
|
|
|
@ -21,7 +21,9 @@ import java.util.GregorianCalendar;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -50,6 +52,18 @@ public class JdbcTimestampJavaType extends AbstractTemporalJavaType<Date> implem
|
||||||
public static final DateTimeFormatter LITERAL_FORMATTER = DateTimeFormatter.ofPattern( TIMESTAMP_FORMAT )
|
public static final DateTimeFormatter LITERAL_FORMATTER = DateTimeFormatter.ofPattern( TIMESTAMP_FORMAT )
|
||||||
.withZone( ZoneId.from( ZoneOffset.UTC ) );
|
.withZone( ZoneId.from( ZoneOffset.UTC ) );
|
||||||
|
|
||||||
|
private static final CacheKeyValueDescriptor CACHE_KEY_VALUE_DESCRIPTOR = new CacheKeyValueDescriptor() {
|
||||||
|
@Override
|
||||||
|
public int getHashCode(Object key) {
|
||||||
|
return INSTANCE.extractHashCode( (Date) key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(Object key1, Object key2) {
|
||||||
|
return INSTANCE.areEqual( (Date) key1, (Date) key2 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public JdbcTimestampJavaType() {
|
public JdbcTimestampJavaType() {
|
||||||
super( Timestamp.class, TimestampMutabilityPlan.INSTANCE );
|
super( Timestamp.class, TimestampMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@ -104,6 +118,11 @@ public class JdbcTimestampJavaType extends AbstractTemporalJavaType<Date> implem
|
||||||
return Long.valueOf( value.getTime() / 1000 ).hashCode();
|
return Long.valueOf( value.getTime() / 1000 ).hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return CACHE_KEY_VALUE_DESCRIPTOR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date coerce(Object value, CoercionContext coercionContext) {
|
public Date coerce(Object value, CoercionContext coercionContext) {
|
||||||
return wrap( value, null );
|
return wrap( value, null );
|
||||||
|
|
|
@ -20,6 +20,9 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -167,4 +170,9 @@ public class LocalDateJavaType extends AbstractTemporalJavaType<LocalDate> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -189,4 +192,9 @@ public class LocalDateTimeJavaType extends AbstractTemporalJavaType<LocalDateTim
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
return LocalDateTime.now( ClockHelper.forPrecision( precision, session ) );
|
return LocalDateTime.now( ClockHelper.forPrecision( precision, session ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,10 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -160,4 +163,9 @@ public class LocalTimeJavaType extends AbstractTemporalJavaType<LocalTime> {
|
||||||
public int getDefaultSqlPrecision(Dialect dialect, JdbcType jdbcType) {
|
public int getDefaultSqlPrecision(Dialect dialect, JdbcType jdbcType) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ package org.hibernate.type.descriptor.java;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,4 +109,9 @@ public class LocaleJavaType extends AbstractClassJavaType<Locale> {
|
||||||
}
|
}
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,10 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
|
@ -212,4 +215,9 @@ public class LongJavaType extends AbstractClassJavaType<Long>
|
||||||
Integer precision, Integer scale, SharedSessionContractImplementor session) {
|
Integer precision, Integer scale, SharedSessionContractImplementor session) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.type.descriptor.java;
|
package org.hibernate.type.descriptor.java;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,4 +34,9 @@ public class ObjectJavaType extends AbstractClassJavaType<Object> {
|
||||||
public <X> Object wrap(X value, WrapperOptions options) {
|
public <X> Object wrap(X value, WrapperOptions options) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,10 @@ import java.util.GregorianCalendar;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.TimeZoneStorageStrategy;
|
import org.hibernate.TimeZoneStorageStrategy;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
@ -239,4 +242,9 @@ public class OffsetDateTimeJavaType extends AbstractTemporalJavaType<OffsetDateT
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
return OffsetDateTime.now( ClockHelper.forPrecision( precision, session ) );
|
return OffsetDateTime.now( ClockHelper.forPrecision( precision, session ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,10 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -175,4 +178,9 @@ public class OffsetTimeJavaType extends AbstractTemporalJavaType<OffsetTime> {
|
||||||
public int getDefaultSqlPrecision(Dialect dialect, JdbcType jdbcType) {
|
public int getDefaultSqlPrecision(Dialect dialect, JdbcType jdbcType) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType;
|
||||||
|
@ -199,4 +202,9 @@ public class ShortJavaType extends AbstractClassJavaType<Short>
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
return (short) ( current + 1 );
|
return (short) ( current + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,11 @@ import java.io.StringReader;
|
||||||
import java.sql.Clob;
|
import java.sql.Clob;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.engine.jdbc.CharacterStream;
|
import org.hibernate.engine.jdbc.CharacterStream;
|
||||||
import org.hibernate.engine.jdbc.internal.CharacterStreamImpl;
|
import org.hibernate.engine.jdbc.internal.CharacterStreamImpl;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -112,4 +115,9 @@ public class StringJavaType extends AbstractClassJavaType<String> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ package org.hibernate.type.descriptor.java;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,4 +62,9 @@ public class TimeZoneJavaType extends AbstractClassJavaType<TimeZone> {
|
||||||
}
|
}
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ package org.hibernate.type.descriptor.java;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.BytesHelper;
|
import org.hibernate.internal.util.BytesHelper;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -155,4 +158,9 @@ public class UUIDJavaType extends AbstractClassJavaType<UUID> {
|
||||||
return new UUID( BytesHelper.asLong( bytea, 0 ), BytesHelper.asLong( bytea, 8 ) );
|
return new UUID( BytesHelper.asLong( bytea, 0 ), BytesHelper.asLong( bytea, 8 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -65,4 +68,9 @@ public class UrlJavaType extends AbstractClassJavaType<URL> {
|
||||||
}
|
}
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import java.sql.Types;
|
||||||
import java.time.Year;
|
import java.time.Year;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -82,4 +85,9 @@ public class YearJavaType extends AbstractClassJavaType<Year> {
|
||||||
|
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ package org.hibernate.type.descriptor.java;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -67,4 +70,9 @@ public class ZoneIdJavaType extends AbstractClassJavaType<ZoneId> {
|
||||||
|
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,10 @@ import java.util.GregorianCalendar;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.TimeZoneStorageStrategy;
|
import org.hibernate.TimeZoneStorageStrategy;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.internal.util.ZonedDateTimeComparator;
|
import org.hibernate.internal.util.ZonedDateTimeComparator;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
|
@ -235,4 +238,9 @@ public class ZonedDateTimeJavaType extends AbstractTemporalJavaType<ZonedDateTim
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
return ZonedDateTime.now( ClockHelper.forPrecision( precision, session ) );
|
return ZonedDateTime.now( ClockHelper.forPrecision( precision, session ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.type.descriptor.java.spi;
|
package org.hibernate.type.descriptor.java.spi;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.cache.internal.DefaultCacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
import org.hibernate.type.descriptor.WrapperOptions;
|
||||||
import org.hibernate.type.descriptor.java.AbstractClassJavaType;
|
import org.hibernate.type.descriptor.java.AbstractClassJavaType;
|
||||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||||
|
@ -60,6 +63,11 @@ public class JavaTypeBasicAdaptor<T> extends AbstractClassJavaType<T> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
return DefaultCacheKeyValueDescriptor.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "JavaTypeBasicAdaptor(" + getJavaType().getTypeName() + ")";
|
return "JavaTypeBasicAdaptor(" + getJavaType().getTypeName() + ")";
|
||||||
|
|
|
@ -8,6 +8,8 @@ package org.hibernate.type.internal;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||||
import org.hibernate.type.AdjustableBasicType;
|
import org.hibernate.type.AdjustableBasicType;
|
||||||
|
@ -25,6 +27,8 @@ public class BasicTypeImpl<J> extends AbstractSingleColumnStandardBasicType<J> i
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
private transient CacheKeyValueDescriptor cacheKeyValueDescriptor;
|
||||||
|
|
||||||
public BasicTypeImpl(JavaType<J> jtd, JdbcType std) {
|
public BasicTypeImpl(JavaType<J> jtd, JdbcType std) {
|
||||||
super( std, jtd );
|
super( std, jtd );
|
||||||
name = String.format(
|
name = String.format(
|
||||||
|
@ -70,4 +74,13 @@ public class BasicTypeImpl<J> extends AbstractSingleColumnStandardBasicType<J> i
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
CacheKeyValueDescriptor cacheKeyValueDescriptor = this.cacheKeyValueDescriptor;
|
||||||
|
if ( cacheKeyValueDescriptor == null ) {
|
||||||
|
this.cacheKeyValueDescriptor = cacheKeyValueDescriptor = getMappedJavaType().toCacheKeyDescriptor( sessionFactory );
|
||||||
|
}
|
||||||
|
return cacheKeyValueDescriptor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.Hibernate;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
||||||
|
import org.hibernate.cache.internal.CacheKeyValueDescriptor;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
|
@ -34,7 +35,6 @@ import org.hibernate.type.TrueFalseConverter;
|
||||||
import org.hibernate.type.YesNoConverter;
|
import org.hibernate.type.YesNoConverter;
|
||||||
import org.hibernate.type.descriptor.ValueBinder;
|
import org.hibernate.type.descriptor.ValueBinder;
|
||||||
import org.hibernate.type.descriptor.ValueExtractor;
|
import org.hibernate.type.descriptor.ValueExtractor;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
|
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
|
||||||
|
@ -59,6 +59,8 @@ public class ConvertedBasicTypeImpl<J> implements ConvertedBasicType<J>,
|
||||||
private final ValueExtractor<J> jdbcValueExtractor;
|
private final ValueExtractor<J> jdbcValueExtractor;
|
||||||
private final JdbcLiteralFormatter<J> jdbcLiteralFormatter;
|
private final JdbcLiteralFormatter<J> jdbcLiteralFormatter;
|
||||||
|
|
||||||
|
private transient CacheKeyValueDescriptor cacheKeyValueDescriptor;
|
||||||
|
|
||||||
public ConvertedBasicTypeImpl(
|
public ConvertedBasicTypeImpl(
|
||||||
String name,
|
String name,
|
||||||
JdbcType jdbcType,
|
JdbcType jdbcType,
|
||||||
|
@ -416,4 +418,13 @@ public class ConvertedBasicTypeImpl<J> implements ConvertedBasicType<J>,
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheKeyValueDescriptor toCacheKeyDescriptor(SessionFactoryImplementor sessionFactory) {
|
||||||
|
CacheKeyValueDescriptor cacheKeyValueDescriptor = this.cacheKeyValueDescriptor;
|
||||||
|
if ( cacheKeyValueDescriptor == null ) {
|
||||||
|
this.cacheKeyValueDescriptor = cacheKeyValueDescriptor = converter.getDomainJavaType().toCacheKeyDescriptor( sessionFactory );
|
||||||
|
}
|
||||||
|
return cacheKeyValueDescriptor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue