Skip to content

Data Type

Yong Zhu edited this page Jan 20, 2018 · 1 revision

Data Type Translate

Different databases have different data types, detail can see DatabaseDialects.xls file. jDialects offer some methods to do the translation:

In TypeUtils:
//Translate java.sql.Types.xxx to Dialect.Type
public static Type javaSqlTypeToDialectType(int javaSqlType) 

//Translate column definition String to Dialect.Type
public static Type toType(String columnDef) 

//Translate Java's primitive class like String to Dialect.Type
public static Type toType(Class<?> clazz) 

//Check if a Java class can transfer to Dialect.Type
public static boolean canMapToSqlType(Class<?> clazz)

In Dialect:
//Translate Dialect.Type to DDL definition String
public String translateToDDLType(Type type, Integer... lengths)