Data Conversion Models

To get the best fit of the database datetypes and the application data types use the conversion types that produces the least conversion and validation inside your application code.
For example : the internal length of Oracle number type is 21-byte. Only the Java type java.Math.BigDecimal supports the full range of the Oracle type number. The use of Java type java.Math.BigDecimal produces a lot of conversion inside the Java code and a lot of additional checks. The numeric conversion models garantees not to loose numeric information by cropped high bits or null values.

Integer Conversion Models

  • int : Integer values fits into 32-bit integer. Input parameter values are autoboxed and Null values are allowed. Output values and transfer object fields are of type int, no null values are allowed. Null values will raise NullPointerException. Numeric range overflow will raise ArithmeticException.
  • java.lang.Integer : Integer values fits into 32-bit integer. Input parameter values are autoboxed and Null values are allowed. Output values and transfer object fields are of type Integer, null values are allowed. Numeric range overflow will raise ArithmeticException.
  • long : Long values fits into 64-bit integer. Input parameter values are autoboxed and Null values are allowed. Output values and transfer object fields are of type long, no null values are allowed. Null values will raise NullPointerException. Numeric range overflow will raise ArithmeticException.
  • java.lang.Long : Long values fits into 64-bit integer. Input parameter values are autoboxed and Null values are allowed. Output values and transfer object fields are of type Long, null values are allowed. Numeric range overflow will raise ArithmeticException.
  • java.Math.BigDecimal : Supports full database precision including null values but also has more precision than can be stored in database.

Floating Point Conversion Models

  • double : Floating point values fits into 64-bit. Input parameter values are autoboxed and Null values are allowed. Output values and transfer object fields are of type double, no null values are allowed. Null values will raise NullPointerException.
  • java.lang.Double : Floating point values fits into 64-bit. Input parameter values are autoboxed and Null values are allowed. Output values and transfer object fields are of type java.lang.Double, null values are allowed.
  • java.Math.BigDecimal : Supports full database precision including null values but also has more precision than can be stored in database.

Date Conversion Models

  • java.sql.Date : No conversion.
  • java.util.Date : Conversion from/to java.util.Date.
  • java.time.LocalDate : Conversion from/to java.time.LocalDate. Requires Java 8. Caution : Time information ist lost !
  • java.time.LocalDateTime : Conversion from/to java.time.LocalDateTime. Requires Java 8.

Timestamp Conversion Models

  • java.sql.Timestamp : No conversion.
  • java.time.LocalDate : Conversion from/to java.time.LocalDate. Requires Java 8.
  • java.time.LocalDateTime : Conversion from/to java.time.LocalDateTime. Requires Java 8.

Timestamp with (Local) Time Zone Conversion Models

  • java.time.ZonedDateTime : Conversion from/to java.time.LocalDateTime. Requires Java 8 and Oracle 21c JDBC Driver. Supports older Oracle Databases as well.