DB2

Data Type

RapidClipse Standard Mapping

Generated Javacode - Example

CHARACTER(n)

Strings with a fixed length of n bytes. n must be greater than 0 and must not be greater than 255. The default length is 1.

visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"CHARACTER"},new String[]{"java.lang.String"},"CHARACTER"));
private String charactertest;


@Column(name = "CHARACTERTEST", nullable = false, length = 10, columnDefinition = "CHARACTER")
public String getCharactertest() {
    return this.charactertest;
}

LONG VARCHAR

Specifies a variable length column for string data. The maximum length of a column of this type is 32700 characters.

visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"LONG VARCHAR"},new String[]{"java.lang.String"},"LONG VARCHAR"));
private String longvarchartest;


@Column(name = "LONGVARCHARTEST", nullable = false, length = 32700, columnDefinition = "LONG VARCHAR")
public String getLongvarchartest() {
    return this.longvarchartest;
}

REAL

A short floating point number with 32 bits. The range of precision is about -7.2E+75 to 7.2E+75. In this range, the largest negative value is about -5.4E-79 and the smallest positive value is about 5.4E-079.

visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"REAL"},new String[]{"java.lang.Float","float"},"REAL"));
private float realtest;


@Column(name = "REALTEST", nullable = false, precision = 24, scale = 0, columnDefinition = "REAL")
public float getRealtest() {
    return this.realtest;
}

INTEGER

A binary integer with a precision of 31 bits. The range is -2147483648 to +2147483647.

Hibernate Standard Mapping

pivate int inttest;


@Column(name = "INTTEST", unique = true, nullable = false)
public int getInttest() {
    return this.inttest;
}

BIGINT

A binary integer with a precision of 63 bits. The range of large integers is -9223372036854775808 to +9223372036854775807.

Hibernate Standard Mapping

pivate int inttest;


@Column(name = "INTTEST", unique = true, nullable = false)
public int getInttest() {
    return this.inttest;
}

BLOB

Data type for storing large amounts of non-character data, such as images, speech, and mixed media.

<sql-type jdbc-type="BLOB" hibernate-type="byte[]"></sql-type>
visitor.addPropertyColumnDefinitionFix(
    new PropertyColumnDefinitionFix(new String[]{"BLOB"},new String[]{"byte[]"},"blob")
        .addLobAnnotation());
private byte[] blobtest;


@Lob
@Column(name = "BLOBTEST", columnDefinition = "blob")
public byte[] getBlobtest() {
    return this.blobtest;
}

CLOB

Data type for storing SBCS or mixed data, e.g. documents that contain only one character set. Use this data type if your data is (or could become) larger than the VARCHAR data type allows.

<sql-type jdbc-type="CLOB" hibernate-type="java.lang.String"></sql-type>
visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(new String[]{"CLOB"},new String[]
        {"java.lang.String"},"clob").addLobAnnotation());
private String clobtest;


@Lob
@Column(name = "CLOBTEST", nullable = false, columnDefinition = "clob")
public String getClobtest() {
    return this.clobtest;
}

DATE

A three-part value representing a year, month, and day in the range 0001-01-01 to 9999-12-31.

Hibernate Standard Mapping

private Date datetest;


@Temporal(TemporalType.DATE)
@Column(name = "DATETEST", nullable = false, length = 10)
public Date getDatetest() {
    return this.datetest;
}

DECIMAL

A packed decimal number with an implicit decimal point.
The position of the decimal point is determined by the precision and scale of the number.
The scaling, i.e. the number of digits in the decimal part of the number, cannot be negative or greater than the precision. The maximum precision is 31 digits. All values of a decimal column have the same precision and scaling. The range of a decimal variable or the numbers in a decimal column is -n to +n, where n is the largest positive number that can be represented with the applicable precision and scale. The maximum range is 1 - 10³¹ to 10³¹ - 1.

visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"DECIMAL"},new String[]{"java.math.BigDecimal"},"decimal"));
private BigDecimal decimaltest;


@Column(name = "DECIMALTEST", nullable = false, precision = 6, columnDefinition = "decimal")
public BigDecimal getDecimaltest() {
    return this.decimaltest;
}
private double decimaltest;


@Column(name = "DECIMALTEST", nullable = false, precision = 6, columnDefinition = "decimal")
public double getDecimaltest() {
    return this.decimaltest;
}

DOUBLE

A floating point number with 64 bits. The range of the "double" is about -7.2E+75 to 7.2E+75. In this range, the largest negative value is about -5.4E-79 and the smallest positive value is about 5.4E-079.

Hibernate Standard Mapping

private double doubletest;

@Column(name = "DOUBLETEST", nullable = false, precision = 53, scale = 0)
public double getDoubletest() {
    return this.doubletest;
}

SMALLINT

A binary integer with a precision of 15 bits. The range is -32768 to +32767.

Hibernate Standard Mapping

private short smallinttest;

@Column(name = "SMALLINTTEST", nullable = false)
public short getSmallinttest() {
    return this.smallinttest;
}

TIME

A three-part value indicating the time of day in hours, minutes and seconds in the range 00.00.00 to 24.00.00.

Hibernate Standard Mapping

private Date timetest;





@Temporal(TemporalType.TIME)
@Column(name = "TIMETEST", nullable = false, length = 8)
public Date getTimetest() {
    return this.timetest;
}

TIMESTAMP

TIMESTAMP. A timestamp is a seven-part value representing a date and time byyear, month, day,hour, minute, second, and microsecond, in the range of 0001-01-01-00.00.00.000000000 to 9999-12-31-24.00.00.000000000 with nanosecond precision. Timestamps canalso hold timezone information.

Hibernate Standard Mapping

private Date timestamptest;





@Temporal(TemporalType.TIMESTAMP)
@Column(name = "TIMESTAMPTEST", nullable = false, length = 26)
public Date getTimestamptest() {
    return this.timestamptest;
}

VARCHAR

With a maximum length of n bytes. n must be greater than 0 and less than a number that depends on the page size of the table space. The maximum length is 32704.

Hibernate Standard Mapping

private String varchartest;





@Column(name = "VARCHARTEST", nullable = false, length = 10)
public String getVarchartest() {
    return this.varchartest;
}