Skip to main content

Type Support

The table recommends Java property types for common Dameng columns. Use wrapper types for nullable fields. NUMBER precision does not select a Java type automatically. See Java/JDBC types.

Common Types

Database column typeJava typeNotes
BITBoolean0 is false and a nonzero value is true.
TINYINTByteSigned integer from -128 to 127.
BYTEByteInteger with precision 3 and scale 0.
SMALLINTShortSigned integer from -32768 to 32767.
INTEGERIntegerSigned 32-bit integer.
INTIntegerSynonym for INTEGER.
BIGINTLongSigned 64-bit integer.
NUMERIC(p, s)BigDecimalPrecision is at most 38; writes are constrained by the column precision and scale.
DECIMAL(p, s)BigDecimalSimilar semantics to NUMERIC.
DEC(p, s)BigDecimalSynonym for DECIMAL.
NUMBER(p, s)BigDecimalSame semantics as NUMERIC.
REALFloatSingle-precision approximate number.
FLOAT(p)Float / DoubleStored as single precision when p is at most 24 and as double precision when p is greater than 24. Choose the Java property from the column definition.
DOUBLEDoubleDouble-precision approximate number.
DOUBLE PRECISIONDoubleDouble-precision approximate number.
CHAR(n)StringFixed-length string; the database pads shorter values with spaces.
CHARACTER(n)StringSynonym for CHAR.
VARCHAR(n)StringVariable-length string.
VARCHAR2(n)StringSame usage as VARCHAR.
TEXTStringLarge text. For JSON text, see JSON Field Mapping.
LONGStringSynonym for TEXT.
LONGVARCHARStringSynonym for TEXT.
CLOBStringLarge text. For JSON text, see JSON Field Mapping.
BINARY(n)byte[]Fixed-length binary content.
VARBINARY(n)byte[]Variable-length binary content.
RAW(n)byte[]Synonym for VARBINARY.
IMAGEbyte[]Binary large object; it may also hold non-image binary content.
LONGVARBINARYbyte[]Synonym for IMAGE.
BLOBbyte[]Binary large object.
DATEjava.sql.DateContains only year, month, and day.
TIMEjava.sql.TimeContains only time fields; fractional-second precision defaults to 0 when omitted.
TIME(p)StringWhen p is from 1 through 6 and fractional seconds must be preserved, use a string or a Dameng JDBC extension object; java.sql.Time cannot represent that precision completely.
TIMESTAMP(p)java.sql.TimestampContains date and time; Dameng supports fractional-second precision up to 9. DATETIME is a synonym.
ROWIDStringAn 18-character value used for a Dameng row identifier.

Scale-zero NUMERIC, DECIMAL, DEC, and NUMBER columns may also map to integer types, but the application must ensure that values have no fractional part and fit the selected Java range. Prefer BigDecimal when the complete column range must be preserved.

Interval Types

Dameng JDBC provides extension objects for interval types. The official driver also permits reading and writing them with getString and setString. Use String when the entity only needs to preserve the complete literal value:

Database column typeJava typeNotes
INTERVAL YEARStringYear interval; the value must follow the Dameng interval literal format.
INTERVAL MONTHStringMonth interval; the value must follow the Dameng interval literal format.
INTERVAL YEAR TO MONTHStringYear-to-month interval.
INTERVAL DAYStringDay interval.
INTERVAL DAY TO HOURStringDay-to-hour interval.
INTERVAL DAY TO MINUTEStringDay-to-minute interval.
INTERVAL DAY TO SECONDStringDay-to-second interval, optionally with fractional seconds.
INTERVAL HOURStringHour interval.
INTERVAL HOUR TO MINUTEStringHour-to-minute interval.
INTERVAL HOUR TO SECONDStringHour-to-second interval, optionally with fractional seconds.
INTERVAL MINUTEStringMinute interval.
INTERVAL MINUTE TO SECONDStringMinute-to-second interval, optionally with fractional seconds.
INTERVAL SECONDStringSecond interval, optionally with fractional seconds.

When individual year, month, day, hour, minute, or second components are required, use the Dameng JDBC extension object through a custom mapping. dbVisitor does not automatically convert those proprietary objects to java.time.Duration or Period.

Example: Declare Entity Properties

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import net.hasor.dbvisitor.mapping.Column;

@Column("quantity")
private Short quantity; // SMALLINT

@Column("amount")
private BigDecimal amount; // NUMBER(10, 2)

@Column("business_date")
private Date businessDate; // DATE

@Column("created_at")
private Timestamp createdAt; // TIMESTAMP(6)

@Column("payload")
private byte[] payload; // BLOB

Boundaries

  • BFILE is a read-only server-side file, not a BLOB.
  • Use a custom mapping or RowMapper for zoned time types and XMLTYPE.
  • Use NUMBER with BigDecimal for exact decimals, not a floating-point type.
  • Use Timestamp for TIMESTAMP. Use text or a Dameng JDBC extension object when TIME(p) fractional seconds must be preserved.