diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/package-info.java b/hibernate-core/src/main/java/org/hibernate/annotations/package-info.java index 822b78c5d2..c9e3730b1a 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/package-info.java @@ -55,7 +55,8 @@ * These two approaches cannot be used together. A {@code UserType} always takes precedence * over the compositional approach. *

- * Please see the User Guide for a more in-depth discussion. + * Please see the User Guide or the package {@link org.hibernate.type} for a more + * in-depth discussion. * *

Dialect-specific native SQL

* diff --git a/hibernate-core/src/main/java/org/hibernate/type/package-info.java b/hibernate-core/src/main/java/org/hibernate/type/package-info.java index b8e666cc5d..08b92fe739 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/type/package-info.java @@ -6,14 +6,35 @@ */ /** - * A Hibernate {@link org.hibernate.type.Type} is a strategy for mapping - * a Java property type to a JDBC type or types. In modern Hibernate, - * {@code Type} itself is now of receding importance, and we prefer to - * work directly with the combination of: + * A Hibernate {@link org.hibernate.type.Type} is a strategy for mapping a Java + * property type to a JDBC type or types. In modern Hibernate, {@code Type} itself + * is now of receding importance, and we prefer to work directly with the combination + * of: * + *

+ * A {@code JdbcType} is able to read and write a single Java type to one, or + * sometimes several, {@linkplain org.hibernate.type.SqlTypes JDBC types}. + *

+ * A {@code JavaType} is able to determine if an attribute of a given Java type is + * dirty, and then convert it to one of several other equivalent Java representations + * at the request of its partner {@code JdbcType}. + *

+ * For example, if an entity attribute of Java type {@code BigInteger} is mapped to + * the JDBC type {@link java.sql.Types#VARCHAR}, the + * {@link org.hibernate.type.descriptor.jdbc.VarcharJdbcType} will ask its + * {@link org.hibernate.type.descriptor.java.BigIntegerJavaType} to convert instances + * of {@code BigInteger} to and from {@code String} when writing to and reading from + * JDBC statements and result sets. + *

+ * This approach provides quite some flexibility in allowing a given Java type to + * map to a range of JDBC types. However, when the built-in conversions don't handle + * a particular mapping, a + * {@link org.hibernate.metamodel.model.convert.spi.BasicValueConverter} may assist + * in the conversion process. For example, a JPA + * {@link jakarta.persistence.AttributeConverter} might be provided. * * @see org.hibernate.type.Type * @see org.hibernate.type.SqlTypes