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
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDescriptor
(int sqlTypeCode, DdlType ddlType) Add a mapping from the given type code to the givenDdlType
.void
addDescriptor
(DdlType ddlType) void
addDescriptorIfAbsent
(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.void
addDescriptorIfAbsent
(DdlType ddlType) getDescriptor
(int sqlTypeCode) Returns the registeredDdlType
for the given SQL type code.getSqlTypeCode
(String rawTypeName) Returns theSqlTypes
type code for the given DDL raw type name, ornull
if 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$s
with 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 code
and size, filling in the placemarkers$l
,$p
, and$s
with the length, precision, and scale determined by the given size object.boolean
isTypeNameRegistered
(String typeName) Determines if there is a registeredDdlType
whose 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 theSqlTypes
type code for the given DDL raw type name, ornull
if the type code cannot be determined from the registrations. -
getDescriptor
Returns the registeredDdlType
for the given SQL type code.Note that the "long" types
Types.LONGVARCHAR
,Types.LONGNVARCHAR
, andTypes.LONGVARBINARY
are considered synonyms for their non-LONG
counterparts, with the only difference being that a different default length is used by default:Length.LONG
instead ofLength.DEFAULT
. -
getTypeName
Get the SQL type name for the specifiedJDBC type code
, filling in the placemarkers$l
,$p
, and$s
with 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 code
and size, filling in the placemarkers$l
,$p
, and$s
with 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 code
and size, filling in the placemarkers$l
,$p
, and$s
with 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
- theType
mapped 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 code
and size, filling in the placemarkers$l
,$p
, and$s
with 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 registeredDdlType
whose raw type name matches the given type name, taking into account DDL types registered by Hibernate.- Parameters:
typeName
- the type name.- Returns:
true
if there is a DDL type with the given raw type name
-
getTypeName(int, Size, Type)
instead