diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc index 0651c22efc..d5c5d03944 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc @@ -258,6 +258,16 @@ of the specific database support for nationalized data and allows the applicatio work portably across databases with varying support. ==== +[IMPORTANT] +==== +For databases that do not support `NCLOB` data-types, it is unsupported to map +the attribute using `java.sql.NClob`. Use `java.sql.Clob` (which `NClob` extends) +or use a materialized mapping (`String`, `char[]`, ...) instead. + +See also <> regarding similar limitation for databases which do not support +explicit `CLOB` data-type. +==== + Considering we have the following database table: [[basic-nationalized-sql-example]] @@ -300,6 +310,13 @@ However, some drivers (i.e. PostgreSQL) are trickier and, in such cases, you may extra steps to get LOBs working. Such discussions are beyond the scope of this guide. ==== +[IMPORTANT] +==== +For databases that do not support `CLOB` data-types, it is unsupported to map +the attribute using `java.sql.Clob`. Use a materialized mapping (`String`, +`char[]`, ...) instead. +==== + Mapping basic values to LOB types comes in 2 forms... ===== LOB Locator diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/NClobTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/NClobTest.java index f6eaf8ed37..7e7af93f8b 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/NClobTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/NClobTest.java @@ -33,7 +33,9 @@ import static org.junit.Assert.fail; @Jpa(annotatedClasses = NClobTest.Product.class) @RequiresDialectFeature( feature = DialectFeatureChecks.SupportsNationalizedDataTypes.class, - comment = "@see https://hibernate.atlassian.net/browse/HHH-10693 and https://hibernate.atlassian.net/browse/HHH-10695 and https://hibernate.atlassian.net/browse/HHH-10473" + comment = "This is different from other tests checking generalized nationalization support; " + + "because we explicitly map this attribute to the `NClob` java type the database really" + + " has to support those types" ) public class NClobTest { @Test diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java index 02594c0857..19c65cfb9c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java @@ -54,6 +54,11 @@ public class MariaDBDialect extends MySQLDialect { return version; } + @Override + public NationalizationSupport getNationalizationSupport() { + return NationalizationSupport.IMPLICIT; + } + @Override public void initializeFunctionRegistry(QueryEngine queryEngine) { super.initializeFunctionRegistry(queryEngine); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java index 58e711e5c1..1390167206 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java @@ -45,12 +45,18 @@ abstract public class DialectFeatureChecks { } } + /** + * Does the database support nationalized data in any form + */ public static class SupportsNationalizedData implements DialectFeatureCheck { public boolean apply(Dialect dialect) { return dialect.getNationalizationSupport() != NationalizationSupport.UNSUPPORTED; } } + /** + * Does the database specifically support the explicit nationalized data types + */ public static class SupportsNationalizedDataTypes implements DialectFeatureCheck { public boolean apply(Dialect dialect) { return dialect.getNationalizationSupport() == NationalizationSupport.EXPLICIT;