OrmLite SQL Data Types - Lightweight Java ORM

The following types show the mapping between ORMLite enum, Java types, ResultSet get method, java.sql.Types integer values, ORMLite base database type class, and any overrides that the various databases have. For each of the primitive types, there is also an Object version (ex. BYTE_OBJ) which generates the same SQL but converts to/from Objects.

For more information about the types, see the online docs on the persisted data types. Please contact the author if your database is not included in this list.

ORMLite Java java.sql.Types
Integers
Results Method Base
Database
H2 MysSQL Postgres SQLite Derby HSQLdb MSSQL DB2[2] Oracle[2] ODBC[2] Netezza[2]
STRING String VARCHAR getString VARCHAR                 VARCHAR2    
LONG_STRING String LONGVARCHAR getString TEXT         LONG VARCHAR LONGVARCHAR     LONG    
BOOLEAN boolean BOOLEAN getBoolean BOOLEAN TINYINT(1) TINYINT(1)     SMALLINT BIT BIT SMALLINT      
DATE [1] java.util.Date TIMESTAMP getTimestamp TIMESTAMP   DATETIME         DATETIME        
CHAR char CHAR getChar CHAR         SMALLINT            
BYTE byte TINYINT getByte TINYINT     SMALLINT   SMALLINT     SMALLINT SMALLINT   BYTEINT
BYTE_ARRAY byte[] VARBINARY getBytes BLOB     BYTEA   LONG VARCHAR FOR BIT DATA BINARY IMAGE VARCHAR [] FOR BIT DATA LONG RAW    
SHORT short SMALLINT getShort SMALLINT                      
INTEGER int INTEGER getInt INTEGER                      
LONG long BIGINT getLong BIGINT                 NUMERIC    
FLOAT float FLOAT getFloat FLOAT                      
DOUBLE double DOUBLE getDouble DOUBLE PRECISION                      
SERIALIZABLE Serializable VARBINARY getBytes BLOB     BYTEA     BINARY IMAGE VARCHAR [] FOR BIT DATA LONG RAW    
BIG_DECIMAL_NUMERIC BigDecimal BIG_DECIMAL getBigDecimal NUMERIC                      

There are also types that are supported that use the default SQL types defined above.

ORMLite Java java.sql.Types
Integers
STRING_BYTES String as byte[] VARBINARY
DATE_LONG java.util.Date BIGINT
DATE_STRING java.util.Date VARCHAR
ENUM_STRING Enum VARCHAR
ENUM_INTEGER Enum INTEGER
UUID UUID VARCHAR
BIG_INTEGER BigInteger VARCHAR
BIG_DECIMAL BigDecimal VARCHAR

[1] NOTE: This is a java.util.Date not java.sql.Date.
[2] Provisional support only . Please contact the author if you would like to help testing these databases.

I've used the Castor type mapping page a lot during this process. Although I've had to diverge from it once and a while, it's been the best reference I've found.

Free Spam Protection   Android ORM   Simple Java Zip   JMX using HTTP   Great Eggnog Recipe