Supported Java, IDL, and JDBC/SQL types

Table 8-3 lists the Java, IDL, and JDBC/SQL types that EJB Server supports for persistent storage using mapped fields. Types on one row are equivalent. The JDBC/SQL column lists the java.sql.Types constants that the storage component uses to bind to the database column. When creating tables, ensure that each column’s type is compatible with the JDBC/SQL type that corresponds to the mapped Java field.

Table 8-3: Supported Java, IDL, and JDBC datatypes

Java field type

CORBA IDL field type

JDBC/SQL column type

boolean

boolean

TINYINT

char

char

CHAR

byte

octet

TINYINT

short

short

SMALLINT

int

long

INTEGER

long

long long

BIGINT

float

float

REAL

double

double

FLOAT

java.lang.String

CtsComponents::StringValue

VARCHAR

byte[]

CtsComponents::BinaryValue

VARBINARY

java.lang.Boolean

CtsComponents::BooleanValue

TINYINT

java.lang.Character

CtsComponents::CharValue

CHAR

java.lang.Byte

CtsComponents::OctetValue

TINYINT

java.lang.Short

CtsComponents::ShortValue

SMALLINT

java.lang.Integer

CtsComponents::LongValue

INTEGER

java.lang.Long

CtsComponents::LongLongValue

BIGINT

java.lang.Float

CtsComponents::FloatValue

REAL

java.lang.Double

CtsComponents::DoubleValue

FLOAT

java.lang.BigDecimal

CtsComponents::DecimalValue

DECIMAL

java.lang.Date

CtsComponents::DateValue

DATE

java.lang.Time

CtsComponents::TimeValue

TIME

java.lang.Timestamp

CtsComponents::TimestampValue

TIMESTAMP

Serializable object

(N/A)

VARBINARY

NoteValues that can be null If a field can contain nulls, do not use a primitive type. Instead, use the CtsComponents::TypeValue IDL type and the equivalent Java object type. For example, rather than float, use CtsComponents::FloatValue and java.lang.Float.