uCosminexus Application Server, EJB Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.4.2 Mapping the CMP field and database

This section describes the mapping of the CMP field and database. The mapping will differ for each type of database.

Organization of this subsection
(1) Mapping for HiRDB
(2) Mapping list for Oracle

(1) Mapping for HiRDB

The following table describes the mapping of the CMP field and database for HiRDB.

In the following table, Java data type is the data type of Java supported by CMP, JDBC data type is the java.sql.Types. data type of the JDBC corresponding to the data type of Java, and SQL data type is the DB column type recommended for mapping with the Java data type:

Table 2-11 Mapping of the CMP field and database (when using HiRDB)

Java data type JDBC data type SQL data type
boolean SMALLINT SMALLINT
java.lang.Boolean
byte SMALLINT SMALLINT
java.lang.Byte
char#1 CHAR CHAR(4)
java.lang.Character#1
short SMALLINT SMALLINT
java.lang.Short
int INTEGER INTEGER
java.lang.Integer
long DECIMAL DECIMAL(22)
java.lang.Long
float REAL REAL, SMALLFLT
java.lang.Float
double FLOAT DOUBLE PRECISION
java.lang.Double
byte[]#2 LONGVARBINARY BLOB
java.lang.String#1 VARCHAR VARCHAR(m)
CHAR(n)
MVARCHAR(m)
MCHAR(n)
NVARCHAR(x)
NCHAR(y)#3
java.math.BigDecimal DECIMAL DECIMAL(m,n)#4
java.sql.Date DATE DATE#5
java.sql.Time TIME TIME
java.sql.TimeStamp#6 CHAR CHAR(29)
Serializable type#2 LONGVARBINARY BLOB

#1
For details on the precautions to be taken when using the Fixed-length string SQL type, see 2.4.3 Precautions for using CMP.

#2
HiRDB BLOB maximum value 2147483647 bytes
However, the maximum data size that can be handled depends on the upper limit for the JDBC driver. When you use HiRDB Type4 JDBC Driver, there are no JDBC driver-based restrictions.

#3
The following are the respective ranges of m, n, x, and y:
m: 1 to 32000, n: 1 to 30000, x: 1 to 16000, y: 1 to 15000

#4
The following are the respective ranges of m and n:
m: 1 to 29, n: 1 to 29

#5
The DATE range is from 0001/01/01 to 9999/12/31.

#6
Saved as a string with the format yyyy-mm-dd hh:mm:ss.fffffffff (JDBC date escape).

(2) Mapping list for Oracle

The following table describes the mapping of the CMP field and the database for Oracle.

In the following table, Java data type is the data type of Java supported by CMP, JDBC data type is the java.sql.Types. data type of the JDBC corresponding to the data type of Java, and SQL data type is the DB column type that is recommended for the mapping with the Java data type:

Table 2-12 Mapping of the CMP field and database (when using Oracle)

Java data type JDBC data type SQL data type
boolean NUMERIC NUMBER(38)
java.lang.Boolean
byte NUMERIC NUMBER(38)
java.lang.Byte
char#1 CHAR CHAR(4)
java.lang.Character#1
short NUMERIC NUMBER(38)
java.lang.Short
int NUMERIC NUMBER(38)
java.lang.Integer
long NUMERIC NUMBER(22)
java.lang.Long
float NUMERIC NUMBER
java.lang.Float
double#2 FLOAT FLOAT(126)
java.lang.Double#2
byte[]#3 LONGVARBINARY LONG RAW
java.lang.String#1 VARCHAR VARCHAR(m)
CHAR(n)
LONG#4
java.math.BigDecimal NUMERIC NUMBER(m,n)#5
java.sql.Date DATE DATE#6#7
java.sql.Time CHAR CHAR(8)#8
java.sql.TimeStamp TimeStamp DATE#7 #9
Serializable type#3 LONGVARBINARY LONG RAW

Note:
The BLOB data type mapped in java.sql.Types.BLOB and the CLOB data type mapped in java.spl.Types.CLOB cannot be handled.

#1
For details on the precautions to be taken for using the Fixed-length string SQL type, see 2.4.3 Precautions for using CMP.

#2
Range of Oracle FLOAT(126) 1E-125 to 9.9 ... 9E125
The value might be rounded off.

#3
Oracle LONG RAW maximum value 2 gigabytes.
However, the maximum data size that can be handled depends on the upper limit for the JDBC driver.

#4
The following are the respective ranges of m and n:
m = 1 to 4000, n = 1 to 2000
Furthermore, if "" (blank string of zero length) is saved in Oracle, the value will be converted to NULL.

#5
The following are the respective ranges of m and n:
m = 1 to 38, n = -84 to 127

#6
The DATE range is from -4712/01/01 to 9999/12/31.

#7
The minus value cannot be handled correctly between Java-JDBC drivers for data corresponding to B.C (Before Christ). Therefore, the value cannot be guaranteed.

#8
Saved as a string with format hh:mm:ss (JDBC date escape).

#9
The range of DATE is from -4712/01/01 00:00:00 to 9999/12/31 23:59:59.