Class DdlTypeRegistry
- java.lang.Object
-
- org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry
-
- All Implemented Interfaces:
Serializable
public class DdlTypeRegistry extends Object implements Serializable
Basically a map from SQL type code (int) ->DdlType
- Since:
- 6.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DdlTypeRegistry(TypeConfiguration typeConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDescriptor(int sqlTypeCode, DdlType ddlType)
void
addDescriptor(DdlType ddlType)
void
addDescriptorIfAbsent(int sqlTypeCode, DdlType ddlType)
void
addDescriptorIfAbsent(DdlType ddlType)
DdlType
getDescriptor(int sqlTypeCode)
Returns the registeredDdlType
for the given SQL type code.Integer
getSqlTypeCode(String rawTypeName)
Returns theSqlTypes
type code for the given DDL raw type name, ornull
if it is unknown.String
getTypeName(int typeCode, Long size, Integer precision, Integer scale)
Get 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.String
getTypeName(int typeCode, Dialect dialect)
String
getTypeName(int typeCode, Size size)
boolean
isTypeNameRegistered(String typeName)
Whether or not the given type name has been registered for this dialect (including both hibernate type names and custom-registered type names).
-
-
-
Constructor Detail
-
DdlTypeRegistry
public DdlTypeRegistry(TypeConfiguration typeConfiguration)
-
-
Method Detail
-
addDescriptor
public void addDescriptor(DdlType ddlType)
-
addDescriptor
public void addDescriptor(int sqlTypeCode, DdlType ddlType)
-
addDescriptorIfAbsent
public void addDescriptorIfAbsent(DdlType ddlType)
-
addDescriptorIfAbsent
public void addDescriptorIfAbsent(int sqlTypeCode, DdlType ddlType)
-
getSqlTypeCode
public Integer getSqlTypeCode(String rawTypeName)
Returns theSqlTypes
type code for the given DDL raw type name, ornull
if it is unknown.
-
getDescriptor
public DdlType getDescriptor(int sqlTypeCode)
Returns the registeredDdlType
for the given SQL type code.Not 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:Length.LONG
instead ofLength.DEFAULT
.
-
getTypeName
public String getTypeName(int typeCode, Long size, Integer precision, Integer scale)
Get 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.- Parameters:
typeCode
- the JDBC type codesize
- the SQL length, if anyprecision
- the SQL precision, if anyscale
- the SQL scale, if any- Returns:
- the associated name with smallest capacity >= size, if available and the default type name otherwise
-
isTypeNameRegistered
public boolean isTypeNameRegistered(String typeName)
Whether or not the given type name has been registered for this dialect (including both hibernate type names and custom-registered type names).- Parameters:
typeName
- the type name.- Returns:
- true if the given string has been registered either as a hibernate type or as a custom-registered one
-
-