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";
|
||||
|
||||
//these types hold up to 2 GB
|
||||
case LONGVARCHAR:
|
||||
case LONG32VARCHAR:
|
||||
return "long varchar";
|
||||
case LONGNVARCHAR:
|
||||
case LONG32NVARCHAR:
|
||||
return "long nvarchar";
|
||||
case LONGVARBINARY:
|
||||
case LONG32VARBINARY:
|
||||
return "long binary";
|
||||
|
||||
case NCLOB:
|
||||
|
|
|
@ -264,19 +264,20 @@ public abstract class Dialect implements ConversionContext {
|
|||
* {@code Dialect} by calling {@link #registerColumnType(int,String)}
|
||||
* from the constructor.
|
||||
* <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}
|
||||
* and {@link Types#LONGVARBINARY} are considered synonyms for their
|
||||
* non-{@code LONG} counterparts, with the only difference being that
|
||||
* a different default length is used: {@link org.hibernate.Length#LONG}
|
||||
* instead of {@link org.hibernate.Length#DEFAULT}.
|
||||
* <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
|
||||
* {@link #registerColumnType(int, String)} explicitly. Alternatively,
|
||||
* the registrations may be customized by overriding
|
||||
|
@ -291,15 +292,21 @@ public abstract class Dialect implements ConversionContext {
|
|||
switch (typeCode) {
|
||||
case VARCHAR:
|
||||
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;
|
||||
case NVARCHAR:
|
||||
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;
|
||||
case VARBINARY:
|
||||
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;
|
||||
default:
|
||||
registerColumnType( typeCode, columnType(typeCode) );
|
||||
|
@ -429,11 +436,11 @@ public abstract class Dialect implements ConversionContext {
|
|||
return "blob";
|
||||
|
||||
// by default use the LOB mappings for the "long" types
|
||||
case LONGVARCHAR:
|
||||
case LONG32VARCHAR:
|
||||
return columnType(CLOB);
|
||||
case LONGNVARCHAR:
|
||||
case LONG32NVARCHAR:
|
||||
return columnType(NCLOB);
|
||||
case LONGVARBINARY:
|
||||
case LONG32VARBINARY:
|
||||
return columnType(BLOB);
|
||||
|
||||
default:
|
||||
|
|
|
@ -158,10 +158,10 @@ public class H2Dialect extends Dialect {
|
|||
}
|
||||
|
||||
switch (jdbcTypeCode) {
|
||||
case LONGVARCHAR:
|
||||
case LONGNVARCHAR:
|
||||
case LONG32VARCHAR:
|
||||
case LONG32NVARCHAR:
|
||||
return "varchar";
|
||||
case LONGVARBINARY:
|
||||
case LONG32VARBINARY:
|
||||
return "varbinary";
|
||||
case 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.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.JavaObjectType;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
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,
|
||||
// except for the length limit, we can just use 'text' for the
|
||||
// "long" string types
|
||||
case LONGVARCHAR:
|
||||
case LONGNVARCHAR:
|
||||
case LONG32VARCHAR:
|
||||
case LONG32NVARCHAR:
|
||||
return "text";
|
||||
// use bytea as the "long" binary type (that there is no
|
||||
// real VARBINARY type in Postgres, so we always use this)
|
||||
case LONGVARBINARY:
|
||||
case LONG32VARBINARY:
|
||||
return "bytea";
|
||||
|
||||
case INET:
|
||||
|
|
|
@ -129,11 +129,25 @@ public class SqlTypes {
|
|||
* <P>The constant in the Java programming language, sometimes referred
|
||||
* to as a type code, that identifies the generic SQL type
|
||||
* {@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
|
||||
*/
|
||||
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
|
||||
* 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
|
||||
* to as a type code, that identifies the generic SQL type
|
||||
* {@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
|
||||
*/
|
||||
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
|
||||
* that identifies the generic SQL value
|
||||
|
@ -313,11 +341,25 @@ public class SqlTypes {
|
|||
/**
|
||||
* The constant in the Java programming language, sometimes referred to
|
||||
* 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
|
||||
*/
|
||||
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
|
||||
* as a type code, that identifies the generic SQL type {@code NCLOB}.
|
||||
|
|
Loading…
Reference in New Issue