diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/UUIDTypeDescriptor.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/UUIDTypeDescriptor.java index 694a5012b7..30f8fe7b62 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/UUIDTypeDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/UUIDTypeDescriptor.java @@ -7,10 +7,13 @@ package org.hibernate.type.descriptor.java; import java.io.Serializable; +import java.sql.Types; import java.util.UUID; import org.hibernate.internal.util.BytesHelper; import org.hibernate.type.descriptor.WrapperOptions; +import org.hibernate.type.descriptor.spi.JdbcRecommendedSqlTypeMappingContext; +import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; /** * Descriptor for {@link UUID} handling. @@ -32,6 +35,11 @@ public class UUIDTypeDescriptor extends AbstractTypeDescriptor { return ToStringTransformer.INSTANCE.parse( string ); } + @Override + public SqlTypeDescriptor getJdbcRecommendedSqlType(JdbcRecommendedSqlTypeMappingContext context) { + return context.getTypeConfiguration().getSqlTypeDescriptorRegistry().getDescriptor( Types.VARCHAR ); + } + @SuppressWarnings({ "unchecked" }) public X unwrap(UUID value, Class type, WrapperOptions options) { if ( value == null ) {