Skip to main content

Type Support

The table recommends Java property types for common columns. Use wrapper types for nullable fields. See Java/JDBC types and enum mapping.

Type Mappings

Database field typeJava typeDescription
TINYINTShortCovers 0–255; use Byte only when business values are restricted to 0–127.
SMALLINTShortCovers the range of this signed integer type.
INTIntegerCovers the range of this signed integer type.
BIGINTLongCovers the range of this signed integer type.
REALFloatApproximate values; not for amounts requiring exact decimal arithmetic.
FLOATDoubleApproximate values; not for amounts requiring exact decimal arithmetic.
DECIMAL(10, 2)BigDecimalRetains decimal values; writes are constrained by column precision and scale.
DECIMAL(20, 0)BigInteger / BigDecimalUse BigInteger for integral business values, or BigDecimal for a common decimal model.
BITBooleanUse Boolean semantics, not a general integer property.
CHAR(1)StringText content; the column definition constrains length.
VARCHAR(255)StringText content; the column definition constrains length.
NVARCHAR(255)StringText content; the column definition constrains length.
VARBINARY(1000)byte[]Binary content without character encoding conversion.
VARBINARY(MAX)byte[]Binary content without character encoding conversion.
DATEjava.sql.DateDate only; not for preserving a complete timestamp.
TIMEjava.sql.TimeTime only; text storage requires a parseable time format.
DATETIME2(3)java.sql.TimestampPreserves date and time, subject to column precision.
NVARCHAR(2000)Map / List / BeanWhen storing JSON text, see JSON Field Mapping.
NVARCHAR(MAX)Map / List / BeanWhen storing JSON text, see JSON Field Mapping.

Limits

  • SQL Server TINYINT is unsigned; use SMALLINT for negative values.

Array Types

NULL can be read as a Java null, but non-null arrays cannot be bound, read, or updated through the generic JDBC ARRAY mapping. For example, binding Integer[] with Types.ARRAY is not supported.

To store a list in one field, use a suitable text or JSON column and JSON field mapping. Do not configure that column as JDBC ARRAY. This is separate from expanding a list into an IN condition.