let's not use LONGVARCHAR to mean two different things
This commit is contained in:
parent
eb3bcdb94a
commit
e2be0960fd
|
@ -66,11 +66,11 @@ public class SybaseAnywhereDialect extends SybaseDialect {
|
||||||
return "timestamp with time zone";
|
return "timestamp with time zone";
|
||||||
|
|
||||||
//these types hold up to 2 GB
|
//these types hold up to 2 GB
|
||||||
case LONGVARCHAR:
|
case LONG32VARCHAR:
|
||||||
return "long varchar";
|
return "long varchar";
|
||||||
case LONGNVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "long nvarchar";
|
return "long nvarchar";
|
||||||
case LONGVARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "long binary";
|
return "long binary";
|
||||||
|
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
|
|
|
@ -264,19 +264,20 @@ public abstract class Dialect implements ConversionContext {
|
||||||
* {@code Dialect} by calling {@link #registerColumnType(int,String)}
|
* {@code Dialect} by calling {@link #registerColumnType(int,String)}
|
||||||
* from the constructor.
|
* from the constructor.
|
||||||
* <p>
|
* <p>
|
||||||
* This method is aware of the notion of a maximum length for each of
|
|
||||||
* the types {@link Types#VARCHAR}, {@link Types#NVARCHAR}, and
|
|
||||||
* {@link Types#VARBINARY}, usually the limits defined by
|
|
||||||
* {@link #getMaxVarcharLength()}, {@link #getMaxNVarcharLength()},
|
|
||||||
* and {@link #getMaxVarbinaryLength()}, and registers "long" types
|
|
||||||
* for lengths exceeding the limits.
|
|
||||||
* <p>
|
|
||||||
* The "long" types {@link Types#LONGVARCHAR}, {@link Types#LONGNVARCHAR}
|
* The "long" types {@link Types#LONGVARCHAR}, {@link Types#LONGNVARCHAR}
|
||||||
* and {@link Types#LONGVARBINARY} are considered synonyms for their
|
* and {@link Types#LONGVARBINARY} are considered synonyms for their
|
||||||
* non-{@code LONG} counterparts, with the only difference being that
|
* non-{@code LONG} counterparts, with the only difference being that
|
||||||
* a different default length is used: {@link org.hibernate.Length#LONG}
|
* a different default length is used: {@link org.hibernate.Length#LONG}
|
||||||
* instead of {@link org.hibernate.Length#DEFAULT}.
|
* instead of {@link org.hibernate.Length#DEFAULT}.
|
||||||
* <p>
|
* <p>
|
||||||
|
* This method is aware of the notion of a maximum length for each of
|
||||||
|
* the types {@link Types#VARCHAR}, {@link Types#NVARCHAR}, and
|
||||||
|
* {@link Types#VARBINARY}, usually the limits defined by
|
||||||
|
* {@link #getMaxVarcharLength()}, {@link #getMaxNVarcharLength()},
|
||||||
|
* and {@link #getMaxVarbinaryLength()}, and registers "long32" types,
|
||||||
|
* that is, {@link org.hibernate.Length#LONG32} types, for lengths
|
||||||
|
* exceeding the limits.
|
||||||
|
* <p>
|
||||||
* Any registrations made by this method may be overridden by calling
|
* Any registrations made by this method may be overridden by calling
|
||||||
* {@link #registerColumnType(int, String)} explicitly. Alternatively,
|
* {@link #registerColumnType(int, String)} explicitly. Alternatively,
|
||||||
* the registrations may be customized by overriding
|
* the registrations may be customized by overriding
|
||||||
|
@ -291,15 +292,21 @@ public abstract class Dialect implements ConversionContext {
|
||||||
switch (typeCode) {
|
switch (typeCode) {
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
registerColumnType( typeCode, maxVarcharLength, columnType(typeCode) );
|
registerColumnType( typeCode, maxVarcharLength, columnType(typeCode) );
|
||||||
registerColumnType( typeCode, columnType(LONGVARCHAR) );
|
// we look up the "long" type under the code LONG32VARCHAR
|
||||||
|
// which by default returns the CLOB type
|
||||||
|
registerColumnType( typeCode, columnType(LONG32VARCHAR) );
|
||||||
break;
|
break;
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
registerColumnType( typeCode, maxNVarcharLength, columnType(typeCode) );
|
registerColumnType( typeCode, maxNVarcharLength, columnType(typeCode) );
|
||||||
registerColumnType( typeCode, columnType(LONGNVARCHAR) );
|
// we look up the "long" type under the code LONG32NVARCHAR
|
||||||
|
// which by default returns the NCLOB type
|
||||||
|
registerColumnType( typeCode, columnType(LONG32NVARCHAR) );
|
||||||
break;
|
break;
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
registerColumnType( typeCode, maxVarBinaryLength, columnType(typeCode) );
|
registerColumnType( typeCode, maxVarBinaryLength, columnType(typeCode) );
|
||||||
registerColumnType( typeCode, columnType(LONGVARBINARY) );
|
// we look up the "long" type under the code LONG32VARBINARY
|
||||||
|
// which by default returns the BLOB type
|
||||||
|
registerColumnType( typeCode, columnType(LONG32VARBINARY) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
registerColumnType( typeCode, columnType(typeCode) );
|
registerColumnType( typeCode, columnType(typeCode) );
|
||||||
|
@ -429,11 +436,11 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return "blob";
|
return "blob";
|
||||||
|
|
||||||
// by default use the LOB mappings for the "long" types
|
// by default use the LOB mappings for the "long" types
|
||||||
case LONGVARCHAR:
|
case LONG32VARCHAR:
|
||||||
return columnType(CLOB);
|
return columnType(CLOB);
|
||||||
case LONGNVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return columnType(NCLOB);
|
return columnType(NCLOB);
|
||||||
case LONGVARBINARY:
|
case LONG32VARBINARY:
|
||||||
return columnType(BLOB);
|
return columnType(BLOB);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -158,10 +158,10 @@ public class H2Dialect extends Dialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (jdbcTypeCode) {
|
switch (jdbcTypeCode) {
|
||||||
case LONGVARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONGNVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "varchar";
|
return "varchar";
|
||||||
case LONGVARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "varbinary";
|
return "varbinary";
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
return "array";
|
return "array";
|
||||||
|
|
|
@ -68,7 +68,6 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
||||||
import org.hibernate.sql.ast.tree.Statement;
|
import org.hibernate.sql.ast.tree.Statement;
|
||||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||||
import org.hibernate.type.JavaObjectType;
|
import org.hibernate.type.JavaObjectType;
|
||||||
import org.hibernate.type.SqlTypes;
|
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||||
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
||||||
|
@ -149,12 +148,12 @@ public class PostgreSQLDialect extends Dialect {
|
||||||
// since there's no real difference between TEXT and VARCHAR,
|
// since there's no real difference between TEXT and VARCHAR,
|
||||||
// except for the length limit, we can just use 'text' for the
|
// except for the length limit, we can just use 'text' for the
|
||||||
// "long" string types
|
// "long" string types
|
||||||
case LONGVARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONGNVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "text";
|
return "text";
|
||||||
// use bytea as the "long" binary type (that there is no
|
// use bytea as the "long" binary type (that there is no
|
||||||
// real VARBINARY type in Postgres, so we always use this)
|
// real VARBINARY type in Postgres, so we always use this)
|
||||||
case LONGVARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "bytea";
|
return "bytea";
|
||||||
|
|
||||||
case INET:
|
case INET:
|
||||||
|
|
|
@ -129,11 +129,25 @@ public class SqlTypes {
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* <P>The constant in the Java programming language, sometimes referred
|
||||||
* to as a type code, that identifies the generic SQL type
|
* to as a type code, that identifies the generic SQL type
|
||||||
* {@code LONGVARCHAR}.
|
* {@code LONGVARCHAR}.
|
||||||
|
* <p>
|
||||||
|
* Interpreted by Hibernate as a {@link #VARCHAR}-like type large enough
|
||||||
|
* to hold a string of maximum length {@link org.hibernate.Length#LONG}.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.Length#LONG
|
||||||
*
|
*
|
||||||
* @see Types#LONGVARCHAR
|
* @see Types#LONGVARCHAR
|
||||||
*/
|
*/
|
||||||
public final static int LONGVARCHAR = Types.LONGVARCHAR;
|
public final static int LONGVARCHAR = Types.LONGVARCHAR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A type code used internally by the Hibernate
|
||||||
|
* {@link org.hibernate.dialect.Dialect} to identify a
|
||||||
|
* {@link #VARCHAR}-like type large enough to hold any Java string.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.Length#LONG32
|
||||||
|
*/
|
||||||
|
public final static int LONG32VARCHAR = 4001;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* <P>The constant in the Java programming language, sometimes referred
|
||||||
* to as a type code, that identifies the generic SQL type
|
* to as a type code, that identifies the generic SQL type
|
||||||
|
@ -183,11 +197,25 @@ public class SqlTypes {
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* <P>The constant in the Java programming language, sometimes referred
|
||||||
* to as a type code, that identifies the generic SQL type
|
* to as a type code, that identifies the generic SQL type
|
||||||
* {@code LONGVARBINARY}.
|
* {@code LONGVARBINARY}.
|
||||||
|
* <p>
|
||||||
|
* Interpreted by Hibernate as a {@link #VARBINARY}-like type large enough
|
||||||
|
* to hold a byte array of maximum length {@link org.hibernate.Length#LONG}.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.Length#LONG
|
||||||
*
|
*
|
||||||
* @see Types#LONGVARBINARY
|
* @see Types#LONGVARBINARY
|
||||||
*/
|
*/
|
||||||
public final static int LONGVARBINARY = Types.LONGVARBINARY;
|
public final static int LONGVARBINARY = Types.LONGVARBINARY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A type code used internally by the Hibernate
|
||||||
|
* {@link org.hibernate.dialect.Dialect} to identify a
|
||||||
|
* {@link #VARBINARY}-like type large enough to hold any Java byte array.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.Length#LONG32
|
||||||
|
*/
|
||||||
|
public final static int LONG32VARBINARY = 4003;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language
|
* <P>The constant in the Java programming language
|
||||||
* that identifies the generic SQL value
|
* that identifies the generic SQL value
|
||||||
|
@ -313,11 +341,25 @@ public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* The constant in the Java programming language, sometimes referred to
|
||||||
* as a type code, that identifies the generic SQL type {@code LONGNVARCHAR}.
|
* as a type code, that identifies the generic SQL type {@code LONGNVARCHAR}.
|
||||||
|
* <p>
|
||||||
|
* Interpreted by Hibernate as an {@link #NVARCHAR}-like type large enough
|
||||||
|
* to hold a string of maximum length {@link org.hibernate.Length#LONG}.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.Length#LONG
|
||||||
*
|
*
|
||||||
* @see Types#LONGNVARCHAR
|
* @see Types#LONGNVARCHAR
|
||||||
*/
|
*/
|
||||||
public static final int LONGNVARCHAR = Types.LONGNVARCHAR;
|
public static final int LONGNVARCHAR = Types.LONGNVARCHAR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A type code used internally by the Hibernate
|
||||||
|
* {@link org.hibernate.dialect.Dialect} to identify an
|
||||||
|
* {@link #NVARCHAR}-like type large enough to hold any Java string.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.Length#LONG32
|
||||||
|
*/
|
||||||
|
public final static int LONG32NVARCHAR = 4002;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* The constant in the Java programming language, sometimes referred to
|
||||||
* as a type code, that identifies the generic SQL type {@code NCLOB}.
|
* as a type code, that identifies the generic SQL type {@code NCLOB}.
|
||||||
|
|
Loading…
Reference in New Issue