Class DdlTypeRegistry
java.lang.Object
org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry
- All Implemented Interfaces:
Serializable
A registry mapping
JDBC type codes
to instances of the DdlType interface.- Since:
- 6.0
- Author:
- Christian Beikov
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDescriptor(int sqlTypeCode, DdlType ddlType) Add a mapping from the given type code to the givenDdlType.voidaddDescriptor(DdlType ddlType) voidaddDescriptorIfAbsent(int sqlTypeCode, DdlType ddlType) Add a mapping from the given type code to the givenDdlType, if there is no mapping already present for the given type code.voidaddDescriptorIfAbsent(DdlType ddlType) getDescriptor(int sqlTypeCode) Returns the registeredDdlTypefor the given SQL type code.getSqlTypeCode(String rawTypeName) Returns theSqlTypestype code for the given DDL raw type name, ornullif the type code cannot be determined from the registrations.getTypeName(int typeCode, Long size, Integer precision, Integer scale) Deprecated.getTypeName(int typeCode, Dialect dialect) Get the SQL type name for the specifiedJDBC type code, filling in the placemarkers$l,$p, and$swith the default length, precision, and scale for the given SQL dialect.getTypeName(int typeCode, Size size) Deprecated.not appropriate for named enum or array types, usegetTypeName(int, Size, Type)insteadgetTypeName(int typeCode, Size columnSize, Type type) Get the SQL type name for the specifiedJDBC type codeand size, filling in the placemarkers$l,$p, and$swith the length, precision, and scale determined by the given size object.booleanisTypeNameRegistered(String typeName) Determines if there is a registeredDdlTypewhose raw type name matches the given type name, taking into account DDL types registered by Hibernate.
-
Constructor Details
-
DdlTypeRegistry
-
-
Method Details
-
addDescriptor
-
addDescriptor
Add a mapping from the given type code to the givenDdlType. -
addDescriptorIfAbsent
-
addDescriptorIfAbsent
Add a mapping from the given type code to the givenDdlType, if there is no mapping already present for the given type code. -
getSqlTypeCode
Returns theSqlTypestype code for the given DDL raw type name, ornullif the type code cannot be determined from the registrations. -
getDescriptor
Returns the registeredDdlTypefor the given SQL type code.Note that the "long" types
Types.LONGVARCHAR,Types.LONGNVARCHAR, andTypes.LONGVARBINARYare considered synonyms for their non-LONGcounterparts, with the only difference being that a different default length is used by default:Length.LONGinstead ofLength.DEFAULT. -
getTypeName
Get the SQL type name for the specifiedJDBC type code, filling in the placemarkers$l,$p, and$swith the default length, precision, and scale for the given SQL dialect.- Parameters:
typeCode- the JDBC type codedialect- the dialect which determines the default length, precision, and scale- Returns:
- a SQL column type
-
getTypeName
Deprecated.not appropriate for named enum or array types, usegetTypeName(int, Size, Type)insteadGet the SQL type name for the specifiedJDBC type codeand size, filling in the placemarkers$l,$p, and$swith the length, precision, and scale determined by the given size object. The returned type name should be of a SQL type large enough to accommodate values of the specified size.- Parameters:
typeCode- the JDBC type codesize- an object which determines the length, precision, and scale- Returns:
- the associated type name with the smallest capacity that accommodates the given size, if available, and the default type name otherwise
-
getTypeName
Get the SQL type name for the specifiedJDBC type codeand size, filling in the placemarkers$l,$p, and$swith the length, precision, and scale determined by the given size object. The returned type name should be of a SQL type large enough to accommodate values of the specified size.- Parameters:
typeCode- the JDBC type codecolumnSize- an object which determines the length, precision, and scaletype- theTypemapped to the column- Returns:
- the associated type name with the smallest capacity that accommodates the given size, if available, and the default type name otherwise
- Since:
- 6.3
-
getTypeName
@Deprecated(since="6.3") public String getTypeName(int typeCode, Long size, Integer precision, Integer scale) Deprecated.not appropriate for named enum or array types, usegetTypeName(int, Size, Type)insteadGet the SQL type name for the specifiedJDBC type codeand size, filling in the placemarkers$l,$p, and$swith the given length, precision, and scale. The returned type name should be of a SQL type large enough to accommodate values of the specified size.- Parameters:
typeCode- the JDBC type codesize- the SQL length, if anyprecision- the SQL precision, if anyscale- the SQL scale, if any- Returns:
- the associated type name with the smallest capacity that accommodates the given size, if available, and the default type name otherwise
-
isTypeNameRegistered
Determines if there is a registeredDdlTypewhose raw type name matches the given type name, taking into account DDL types registered by Hibernate.- Parameters:
typeName- the type name.- Returns:
trueif there is a DDL type with the given raw type name
-
getTypeName(int, Size, Type)instead