From 2c16e25a71161479f854ceaed65b7cc1b7d4b894 Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 21 Apr 2023 11:14:48 +0200 Subject: [PATCH] add some examples of interpretation of column Length --- .../src/main/java/org/hibernate/Length.java | 27 +++++++++++++++++++ .../org/hibernate/dialect/MySQLDialect.java | 2 -- .../org/hibernate/dialect/OracleDialect.java | 1 - 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/Length.java b/hibernate-core/src/main/java/org/hibernate/Length.java index 8deb729d1a..cb9261be5c 100644 --- a/hibernate-core/src/main/java/org/hibernate/Length.java +++ b/hibernate-core/src/main/java/org/hibernate/Length.java @@ -40,6 +40,15 @@ public final class Length { * declared using * {@code @JdbcTypeCode(Types.LONGVARCHAR)} or * {@code @JdbcTypeCode(Types.LONGVARBINARY)}. + *

+ * For example, {@code @Column(length=LONG)} results + * in the column type: + * + * + * + * + * + *
{@code varchar(32600)}on h2, Db2, and PostgreSQL
{@code text}on MySQL
{@code clob}on Oracle
{@code varchar(max)}on SQL Server
* * @see org.hibernate.type.descriptor.java.JavaType#getLongSqlLength * @@ -52,6 +61,15 @@ public final class Length { * Used to select a variable-length SQL type large * enough to accommodate values of maximum length * {@value Short#MAX_VALUE}. + *

+ * For example, {@code @Column(length=LONG16)} results + * in the column type: + * + * + * + * + * + *
{@code varchar(32767)}on h2 and PostgreSQL
{@code text}on MySQL
{@code clob}on Oracle and Db2
{@code varchar(max)}on SQL Server
*/ public static final int LONG16 = Short.MAX_VALUE; /** @@ -65,6 +83,15 @@ public final class Length { * declared using * {@code @JdbcTypeCode(SqlTypes.LONG32VARCHAR)} or * {@code @JdbcTypeCode(SqlTypes.LONG32VARBINARY)}. + *

+ * For example, {@code @Column(length=LONG32)} results + * in the column type: + * + * + * + * + * + *
{@code text}on PostgreSQL
{@code longtext}on MySQL
{@code clob}on h2, Oracle, and Db2
{@code varchar(max)}on SQL Server
* * @see org.hibernate.type.SqlTypes#LONG32VARCHAR * @see org.hibernate.type.SqlTypes#LONG32VARBINARY diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java index 0579c95541..e07ef69323 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java @@ -72,7 +72,6 @@ import org.hibernate.type.SqlTypes; import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.jdbc.JdbcType; -import org.hibernate.type.descriptor.jdbc.JsonJdbcType; import org.hibernate.type.descriptor.jdbc.NullJdbcType; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry; import org.hibernate.type.descriptor.sql.internal.CapacityDependentDdlType; @@ -113,7 +112,6 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsDate; import static org.hibernate.type.descriptor.DateTimeUtils.appendAsLocalTime; import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMicros; import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMillis; -import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithNanos; /** * A {@linkplain Dialect SQL dialect} for MySQL 5.7 and above. diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java index a22e361ff3..1ed60c7a51 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java @@ -81,7 +81,6 @@ import org.hibernate.type.NullType; import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType; import org.hibernate.type.descriptor.jdbc.AggregateJdbcType; -import org.hibernate.type.descriptor.jdbc.ArrayJdbcType; import org.hibernate.type.descriptor.jdbc.BlobJdbcType; import org.hibernate.type.descriptor.jdbc.JdbcType; import org.hibernate.type.descriptor.jdbc.NullJdbcType;