Basic Java Type and Database Field Mappings
This appendix describes the basic mapping between a Java field type specified by JEUS and a database column type from the main Database vendors supported by JEUS.
1. Overview
This basic mapping is used when <schema-info><cm-field><type> of the CMP bean is not specified in jeus-ejb-dd.xml. The EJB system searches for Java fields among CMP fields of the bean to obtain a Java type, and the <type> is assumed to be the same as what is specified for the basic mapping in the next section.
Each of the following tables shows three types of columns.
-
Java field type
EJB CMP field types found by searching.
-
SQL type
General SQL types defined in the java.sql.Types class.
-
DB column type
Names of Database column types to be used by JEUS when creating a new table, based on the Java field types that were found.
2. Tibero Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for Tibero.
Java Field Type | SQL Type (java.sql.Types) | Tibero DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
NUMERIC(15,5) |
java.lang.Boolean |
BIT |
SMALLINT |
Boolean |
BIT |
SMALLINT |
java.lang.Byte |
TINYINT |
SMALLINT |
Byte |
TINYINT |
SMALLINT |
java.lang.Character |
CHAR |
CHAR(4) |
Char |
CHAR |
CHAR(4) |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INTEGER |
Int |
INTEGER |
INTEGER |
java.lang.Long |
BIGINT |
NUMERIC(22,0) |
Long |
BIGINT |
NUMERIC(22,0) |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
DOUBLE PRECISION |
Double |
DOUBLE |
DOUBLE PRECISION |
byte[] |
LONGVARBINARY |
LONG RAW |
java.sql.Date |
DATE |
DATE |
java.sql.Time |
TIME |
DATE |
java.sql.Timestamp |
TIMESTAMP |
DATE |
<Java object> |
JAVA OBJECT |
LONG RAW |
3. Oracle Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for Oracle.
Java Field Type | SQL Type (java.sql.Types) | Oracle DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
NUMERIC(15,5) |
java.lang.Boolean |
BIT |
SMALLINT |
Boolean |
BIT |
SMALLINT |
java.lang.Byte |
TINYINT |
SMALLINT |
Byte |
TINYINT |
SMALLINT |
java.lang.Character |
CHAR |
CHAR(4) |
Char |
CHAR |
CHAR(4) |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INTEGER |
Int |
INTEGER |
INTEGER |
java.lang.Long |
BIGINT |
NUMERIC(22,0) |
Long |
BIGINT |
NUMERIC(22,0) |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
DOUBLE PRECISION |
Double |
DOUBLE |
DOUBLE PRECISION |
byte[] |
LONGVARBINARY |
LONG RAW |
java.sql.Date |
DATE |
DATE |
java.sql.Time |
TIME |
DATE |
java.sql.Timestamp |
TIMESTAMP |
DATE |
<Java object> |
JAVA OBJECT |
LONG RAW |
4. Sybase Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for Sybase.
Java Field Type | SQL Type (java.sql.Types) | Sybase DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
NUMERIC(15,5) |
java.lang.Boolean |
BIT |
BIT |
Boolean |
BIT |
BIT |
java.lang.Byte |
TINYINT |
TINYINT |
Byte |
TINYINT |
TINYLINT |
java.lang.Character |
CHAR |
CHAR(4) |
Char |
CHAR |
CHAR(4) |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INT |
Int |
INTEGER |
INT |
java.lang.Long |
BIGINT |
NUMERIC(22,0) |
Long |
BIGINT |
NUMERIC(22,0) |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
DOUBLE PRECISION |
Double |
DOUBLE |
DOUBLE PRECISION |
byte[] |
LONGVARBINARY |
IMAGE |
java.sql.Date |
DATE |
DATETIME |
java.sql.Time |
TIME |
DATETIME |
java.sql.Timestamp |
TIMESTAMP |
Not spported |
<Java object> |
JAVA OBJECT |
IMAGE |
5. MSSQL Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for MSSQL.
Java Field Type | SQL Type (java.sql.Types) | MSSQL DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
NUMERIC(15,5) |
java.lang.Boolean |
BIT |
BIT |
Boolean |
BIT |
BIT |
java.lang.Byte |
TINYINT |
TINYINT |
Byte |
TINYINT |
TINYINT |
java.lang.Character |
CHAR |
CHAR(4) |
Char |
CHAR |
CHAR(4) |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INT |
Int |
INTEGER |
INT |
java.lang.Long |
BIGINT |
NUMERIC(22,0) |
Long |
BIGINT |
NUMERIC(22,0) |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
FLOAT |
Double |
DOUBLE |
FLOAT |
byte[] |
LONGVARBINARY |
IMAGE |
java.sql.Date |
DATE |
DATETIME |
java.sql.Time |
TIME |
DATETIME |
java.sql.Timestamp |
TIMESTAMP |
DATETIME |
<Java object> |
JAVA OBJECT |
IMAGE |
6. DB2 Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for DB2.
Java Field Type | SQL Type (java.sql.Types) | DB2 DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
NUMERIC(15,5) |
java.lang.Boolean |
BIT |
SMALLINT |
Boolean |
BIT |
SMALLINT |
java.lang.Byte |
TINYINT |
SMALLINT |
Byte |
TINYINT |
SMALLINT |
java.lang.Character |
CHAR |
CHARACTER(4) |
Char |
CHAR |
CHARACTER(4) |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INTEGER |
Int |
INTEGER |
INTEGER |
java.lang.Long |
BIGINT |
BIGINT |
Long |
BIGINT |
BIGINT |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
DOUBLE |
Double |
DOUBLE |
DOUBLE |
byte[] |
LONGVARBINARY |
VARCHAR(255) |
java.sql.Date |
DATE |
DATE |
java.sql.Time |
TIME |
TIME |
java.sql.Timestamp |
TIMESTAMP |
TIMESTAMP |
<Java object> |
JAVA OBJECT |
LONG VARCHAR |
7. Cloudscape Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for Cloudspace.
Java Field Type | SQL Type (java.sql.Types) | Cloudscape DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
DECIMAL(15,5) |
java.lang.Boolean |
BIT |
BOOLEAN |
Boolean |
BIT |
BOOLEAN |
java.lang.Byte |
TINYINT |
TINYINT |
Byte |
TINYINT |
TINYINT |
java.lang.Character |
CHAR |
CHAR(4) |
Char |
CHAR |
CHAR(4) |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INTEGER |
Int |
INTEGER |
INTEGER |
java.lang.Long |
BIGINT |
LONGINT |
Long |
BIGINT |
LONGINT |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
DOUBLE PRECISION |
Double |
DOUBLE |
DOUBLE PRECISION |
byte[] |
LONGVARBINARY |
LONG BIT VARYING |
java.sql.Date |
DATE |
DATE |
java.sql.Time |
TIME |
TIME |
java.sql.Timestamp |
TIMESTAMP |
TIMESTAMP |
<Java object> |
JAVA OBJECT |
LONG BIT VARYING |
8. Informix Field - Column Type Mapping
The following table describes the mapping of the EJB CMP field and database for Informix.
Java Field Type | SQL Type (java.sql.Types) | Informix DB Column Type |
---|---|---|
java.lang.String |
VARCHAR |
VARCHAR(255) |
java.math.BigDecimal |
NUMERIC |
NUMERIC(15,5) |
java.lang.Boolean |
BIT |
VARCHAR |
Boolean |
BIT |
VARCHAR |
java.lang.Byte |
TINYINT |
SMALLINT |
Byte |
TINYINT |
SMALLINT |
java.lang.Character |
CHAR |
CHAR |
Char |
CHAR |
CHAR |
java.lang.Short |
SMALLINT |
SMALLINT |
Short |
SMALLINT |
SMALLINT |
java.lang.Integer |
INTEGER |
INTEGER |
Int |
INTEGER |
INTEGER |
java.lang.Long |
BIGINT |
SERIAL8 |
Long |
BIGINT |
SERIAL8 |
java.lang.Float |
REAL |
REAL |
Float |
REAL |
REAL |
java.lang.Double |
DOUBLE |
DOUBLE PRECISION |
Double |
DOUBLE |
DOUBLE PRECISION |
byte[] |
LONGVARBINARY |
VARCHAR(255) |
java.sql.Date |
DATE |
DATE |
java.sql.Time |
TIME |
DATETIME HOUR TO SECOND |
java.sql.Timestamp |
TIMESTAMP |
DATETIME YEAR TO SECOND |
<Java object> |
JAVA OBJECT |
BYTE |