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 voidaddDescriptor(int sqlTypeCode, DdlType ddlType)voidaddDescriptor(DdlType ddlType)voidaddDescriptorIfAbsent(int sqlTypeCode, DdlType ddlType)voidaddDescriptorIfAbsent(DdlType ddlType)DdlTypegetDescriptor(int sqlTypeCode)Returns the registeredDdlTypefor the given SQL type code.IntegergetSqlTypeCode(String rawTypeName)Returns theSqlTypestype code for the given DDL raw type name, ornullif it is unknown.StringgetTypeName(int typeCode, Long size, Integer precision, Integer scale)Get the SQL type name for the specifiedJDBC type codeand size, filling in the placemarkers$l,$p, and$swith the given length, precision, and scale.StringgetTypeName(int typeCode, Dialect dialect)StringgetTypeName(int typeCode, Size size)booleanisTypeNameRegistered(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 theSqlTypestype code for the given DDL raw type name, ornullif it is unknown.
-
getDescriptor
public DdlType getDescriptor(int sqlTypeCode)
Returns the registeredDdlTypefor the given SQL type code.Not that the "long" types
Types.LONGVARCHAR,Types.LONGNVARCHARandTypes.LONGVARBINARYare considered synonyms for their non-LONGcounterparts, with the only difference being that a different default length is used:Length.LONGinstead ofLength.DEFAULT.
-
getTypeName
public String getTypeName(int typeCode, Long size, Integer precision, Integer scale)
Get the SQL type name for the specifiedJDBC type codeand size, filling in the placemarkers$l,$p, and$swith 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
-
-