add some examples of interpretation of column Length

This commit is contained in:
Gavin 2023-04-21 11:14:48 +02:00 committed by Gavin King
parent 6c69c45af8
commit 2c16e25a71
3 changed files with 27 additions and 3 deletions

View File

@ -40,6 +40,15 @@ public final class Length {
* declared using * declared using
* {@code @JdbcTypeCode(Types.LONGVARCHAR)} or * {@code @JdbcTypeCode(Types.LONGVARCHAR)} or
* {@code @JdbcTypeCode(Types.LONGVARBINARY)}. * {@code @JdbcTypeCode(Types.LONGVARBINARY)}.
* <p>
* For example, {@code @Column(length=LONG)} results
* in the column type:
* <table>
* <tr><td>{@code varchar(32600)}</td><td>on h2, Db2, and PostgreSQL</td>
* <tr><td>{@code text}</td><td>on MySQL</td>
* <tr><td>{@code clob}</td><td>on Oracle</td>
* <tr><td>{@code varchar(max)}</td><td>on SQL Server</td></tr>
* </table>
* *
* @see org.hibernate.type.descriptor.java.JavaType#getLongSqlLength * @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 * Used to select a variable-length SQL type large
* enough to accommodate values of maximum length * enough to accommodate values of maximum length
* {@value Short#MAX_VALUE}. * {@value Short#MAX_VALUE}.
* <p>
* For example, {@code @Column(length=LONG16)} results
* in the column type:
* <table>
* <tr><td>{@code varchar(32767)}</td><td>on h2 and PostgreSQL</td>
* <tr><td>{@code text}</td><td>on MySQL</td>
* <tr><td>{@code clob}</td><td>on Oracle and Db2</td>
* <tr><td>{@code varchar(max)}</td><td>on SQL Server</td></tr>
* </table>
*/ */
public static final int LONG16 = Short.MAX_VALUE; public static final int LONG16 = Short.MAX_VALUE;
/** /**
@ -65,6 +83,15 @@ public final class Length {
* declared using * declared using
* {@code @JdbcTypeCode(SqlTypes.LONG32VARCHAR)} or * {@code @JdbcTypeCode(SqlTypes.LONG32VARCHAR)} or
* {@code @JdbcTypeCode(SqlTypes.LONG32VARBINARY)}. * {@code @JdbcTypeCode(SqlTypes.LONG32VARBINARY)}.
* <p>
* For example, {@code @Column(length=LONG32)} results
* in the column type:
* <table>
* <tr><td>{@code text}</td><td>on PostgreSQL</td>
* <tr><td>{@code longtext}</td><td>on MySQL</td>
* <tr><td>{@code clob}</td><td>on h2, Oracle, and Db2</td>
* <tr><td>{@code varchar(max)}</td><td>on SQL Server</td></tr>
* </table>
* *
* @see org.hibernate.type.SqlTypes#LONG32VARCHAR * @see org.hibernate.type.SqlTypes#LONG32VARCHAR
* @see org.hibernate.type.SqlTypes#LONG32VARBINARY * @see org.hibernate.type.SqlTypes#LONG32VARBINARY

View File

@ -72,7 +72,6 @@ import org.hibernate.type.SqlTypes;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType; 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.NullJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.descriptor.sql.internal.CapacityDependentDdlType; 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.appendAsLocalTime;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMicros; import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMicros;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMillis; 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. * A {@linkplain Dialect SQL dialect} for MySQL 5.7 and above.

View File

@ -81,7 +81,6 @@ import org.hibernate.type.NullType;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType; import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
import org.hibernate.type.descriptor.jdbc.AggregateJdbcType; 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.BlobJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType; import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.NullJdbcType; import org.hibernate.type.descriptor.jdbc.NullJdbcType;