diff --git a/documentation/src/main/docbook/devguide/en-US/Data_Categorizations.xml b/documentation/src/main/docbook/devguide/en-US/Data_Categorizations.xml index 472e4aeb7d..d1a881a62a 100644 --- a/documentation/src/main/docbook/devguide/en-US/Data_Categorizations.xml +++ b/documentation/src/main/docbook/devguide/en-US/Data_Categorizations.xml @@ -35,6 +35,7 @@ + @@ -294,7 +295,111 @@ - +
+ National Character Types + + National Character types, which is a new feature since JDBC 4.0 API, now available in hibernate type system. + National Language Support enables you retrieve data or insert data into a database in any character + set that the underlying database supports. + + + + Depending on your environment, you might want to set the configuration option hibernate.use_nationalized_character_data + to true and having all string or clob based attributes having this national character support automatically. + There is nothing else to be changed, and you don't have to use any hibernate specific mapping, so it is portable + ( though the national character support feature is not required and may not work on other JPA provider impl ). + + + + The other way of using this feature is having the @Nationalized annotation on the attribute + that should be nationalized. This only works on string based attributes, including string, char, char array and clob. + + + @Entity( name="NationalizedEntity") + public static class NationalizedEntity { + @Id + private Integer id; + + @Nationalized + private String nvarcharAtt; + + @Lob + @Nationalized + private String materializedNclobAtt; + + @Lob + @Nationalized + private NClob nclobAtt; + + @Nationalized + private Character ncharacterAtt; + + @Nationalized + private Character[] ncharArrAtt; + + @Type(type = "ntext") + private String nlongvarcharcharAtt; + } + + + + National Character Type Mappings + + + + Hibernate type + Database type + JDBC type + Type registry + + + + + org.hibernate.type.StringNVarcharType + string + NVARCHAR + nstring + + + org.hibernate.type.NTextType + string + LONGNVARCHAR + materialized_clob + + + org.hibernate.type.NClobType + java.sql.NClob + NCLOB + nclob + + + org.hibernate.type.MaterializedNClobType + string + NCLOB + materialized_nclob + + + org.hibernate.type.PrimitiveCharacterArrayNClobType + char[] + NCHAR + char[] + + + org.hibernate.type.CharacterNCharType + java.lang.Character + NCHAR + ncharacter + + + org.hibernate.type.CharacterArrayNClobType + java.lang.Character[] + NCLOB + Character[], java.lang.Character[] + + + +
+
Composite types diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 060343c670..88af1d7786 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -622,6 +622,11 @@ public interface AvailableSettings { */ public static final String USE_DIRECT_REFERENCE_CACHE_ENTRIES = "hibernate.cache.use_reference_entries"; + /** + * Enable nationalized character support on all string / clob based attribute ( string, char, clob, text etc ). + * + * Default is false. + */ public static final String USE_NATIONALIZED_CHARACTER_DATA = "hibernate.use_nationalized_character_data"; /** @@ -631,7 +636,7 @@ public interface AvailableSettings { * to handle this situation requires checking the Thread ID every time * Session is called. This can certainly have performance considerations. * - * Default is true (enabled). + * Default is true (enabled). */ public static final String JTA_TRACK_BY_THREAD = "hibernate.jta.track_by_thread"; }