diff --git a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java index 3f9e9f6298..8293e02966 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java @@ -347,13 +347,16 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable { case "duration": return getBasicTypeForJavaType( Duration.class ); case "instant": return getBasicTypeForJavaType( Instant.class ); case "binary": return getBasicTypeForJavaType( byte[].class ); - case "uuid": return getBasicTypeForJavaType( UUID.class ); //this one is very fragile ... works well for BIT or BOOLEAN columns only //works OK, I suppose, for integer columns, but not at all for char columns case "boolean": return getBasicTypeForJavaType( Boolean.class ); case "truefalse": return basicTypeRegistry.getRegisteredType( StandardBasicTypes.TRUE_FALSE.getName() ); case "yesno": return basicTypeRegistry.getRegisteredType( StandardBasicTypes.YES_NO.getName() ); case "numericboolean": return basicTypeRegistry.getRegisteredType( StandardBasicTypes.NUMERIC_BOOLEAN.getName() ); + //really not sure about this one - it works well for casting from binary + //to UUID, but people will want to use it to cast from varchar, and that + //won't work at all without some special casing in the Dialects +// case "uuid": return getBasicTypeForJavaType( UUID.class ); default: { final BasicType registeredBasicType = basicTypeRegistry.getRegisteredType( name ); if ( registeredBasicType != null ) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java index 9601c9764f..2d9a63980d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java @@ -2293,8 +2293,8 @@ public class FunctionTests { scope.inTransaction(s -> { byte[] bytes = s.createSelectionQuery("select column(e.theuuid as binary) from EntityOfBasics e", byte[].class) .getSingleResultOrNull(); - UUID uuid = s.createSelectionQuery("select column(e.theuuid as UUID) from EntityOfBasics e", UUID.class) - .getSingleResultOrNull(); +// UUID uuid = s.createSelectionQuery("select column(e.theuuid as UUID) from EntityOfBasics e", UUID.class) +// .getSingleResultOrNull(); }); }