diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java index 544c38379a06..490df12f52cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java @@ -155,6 +155,7 @@ import org.hibernate.type.CustomType; import org.hibernate.type.ForeignKeyDirection; import org.hibernate.type.StandardBasicTypes; +import org.hibernate.type.internal.BasicTypeImpl; import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.usertype.CompositeUserType; import org.hibernate.usertype.ParameterizedType; @@ -1877,11 +1878,22 @@ private void resolveLob(final SingularAttributeSourceBasic attributeSource, Simp // Resolves whether the property is LOB based on the type attribute on the attribute property source. // Essentially this expects the type to map to a CLOB/NCLOB/BLOB sql type internally and compares. if ( !value.isLob() && value.getTypeName() != null ) { - final BasicType basicType = attributeSource.getBuildingContext() - .getMetadataCollector() - .getTypeConfiguration() - .getBasicTypeRegistry() - .getRegisteredType( value.getTypeName() ); + BasicType basicType = null; + + if ( value.getTypeName().startsWith( BasicTypeImpl.EXTERNALIZED_PREFIX ) ) { + basicType = attributeSource.getBuildingContext() + .getBootstrapContext() + .resolveAdHocBasicType( value.getTypeName() ); + } + + if ( basicType == null ) { + basicType = attributeSource.getBuildingContext() + .getMetadataCollector() + .getTypeConfiguration() + .getBasicTypeRegistry() + .getRegisteredType( value.getTypeName() ); + } + if ( basicType instanceof AbstractSingleColumnStandardBasicType ) { if ( isLob( basicType.getJdbcType().getDdlTypeCode(), null ) ) { value.makeLob();