PostgreSQL

Data type

RapidClipse default mapping

Generated Javacode (example)

MONEY

Currency amount

Range: -92233720368547758.08

to +92233720368547758.07

Storage: 8 bytes

<sql-type jdbc-type="NUMERIC" name="money" hibernate-type="java.math.BigDecimal" />
visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"MONEY"},new String[]{"java.math.BigDecimal"},"money"));
private BigDecimal moneyTest;
@Column(name = "`MoneyTest`", scale = 0,
            columnDefinition = "money")
public BigDecimal getMoneyTest() {
    return this.moneyTest;
}

BIGINT

Large-range integer

Range: -9223372036854775808

to 9223372036854775807

Storage: 8 bytes

Hibernate default mapping

private Long bigintTest;
@Column(name = "`BigintTest`")
public Long getBigintTest() {
    return this.bigintTest;
}

BIGSERIAL

Large autoincrementing integer

1 to 9223372036854775807

Storage: 8 bytes

Hibernate default mapping

private long bigserial;
@Column(name = "`Bigserial`", nullable = false)
public long getBigserial() {
    return this.bigserial;
}

BOLEAN

PostgreSQL provides the standard

SQL type boolean. Boolean can have one of only two states: "true" or false". A third state, "unknown", is represented by the SQL null value.

Hibernate default mapping

private Boolean booleanTest;
@Column(name = "`BooleanTest`")
public Boolean getBooleanTest() {
    return this.booleanTest;
}

BYTEA

A variable-length binary string.

Storage: 1 or 4 bytes plus the

actual binary string.

Hibernate default mapping

private byte[] byteaTest;
@Column(name = "`ByteaTest`")
public byte[] getByteaTest() {
    return this.byteaTest;
}

CHARACTER

Character string with fixed-length

and blank padding.

visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"BPCHAR"},new String[]{"java.lang.String"},"bpchar"));
private String characterTest;
@Column(name = "`CharacterTest`", length = 10,
            columnDefinition = "bpchar")
public String getCharacterTest() {
    return this.characterTest;
}

CHARACTER VARYING

Character string with variable-length with limit.

Hibernate default mapping

private String characterVaryingTest;
@Column(name = "`Character_varyingTest`")
public String getCharacterVaryingTest() {
    return this.characterVaryingTest;
}

DATE

Storage: 4 bytes

Range: 4713 BC - 5874897 AD

Resolution: 1 day

Hibernate default mapping

private Date dateTest;
@Temporal(TemporalType.DATE)
@Column(name = "`DateTest`", length = 13)
public Date getDateTest() {
    return this.dateTest;
}

DOUBLE PRECISION

A user-specified precision, exact number

Range: 15 decimal digits precision

Storage: 8 bytes

Hibernate default mapping

private Double doublePrecisionTest;
@Column(name = "`Double_precisionTest`", precision = 17,
            scale = 17)
public Double getDoublePrecisionTest() {
    return this.doublePrecisionTest;
}

INTEGER

A normal integer

Range: -2147483648 to +2147483647

Storage: 4 bytes

Hibernate default mapping

private Integer integerTest;
@Column(name = "`IntegerTest`")
public Integer getIntegerTest() {
    return this.integerTest;
}

NUMERIC

A user-specified precision, exact number

Range: no limit

Storage: variable

Hibernate default mapping

private BigDecimal numericTest;
@Column(name = "`NumericTest`", precision = 131089,
            scale = 0)
public BigDecimal getNumericTest() {
    return this.numericTest;
}

REAL

A user-specified precision, exact number

Range: 6 decimal digits precision

Storage: 4 bytes

Hibernate default mapping

private Float realTest;
@Column(name = "`RealTest`", precision = 8,
            scale = 8)
public Float getRealTest() {
    return this.realTest;
}

SERIAL

Autoincrementing integer

Range: 1 to 2147483647

Storage: 4 bytes

visitor.addPropertyColumnDefinitionFix(new PropertyColumnDefinitionFix(
    new String[]{"SERIAL"},new String[]{"java.lang.Integer","int"},"int2"));
private int serialTest;
@Column(name = "`SerialTest`", nullable = false)
public int getSerialTest() {
    return this.serialTest;
}

SMALLINT

Small-range integer

Range: -32768 to +32767

Storage: 2 bytes

Hibernate default mapping

private Short smallintTest;
@Column(name = "`SmallintTest`")
public Short getSmallintTest() {
    return this.smallintTest;
}

TEXT

Character string with variable

unlimited length.

Hibernate default mapping

private BigDecimal moneyTest;
@Column(name = "`TextTest`")
public String getTextTest() {
    return this.textTest;
}

TIME WITH TIME ZONE

Time of day with time zone.

Storage: 12 bytes

Range: 00:00:00+1459 - 24:00:00-1459

Resolution: 1 microsecond / 14 digits

Hibernate default mapping

private Date timeWithTimeZoneTest;
@Temporal(TemporalType.TIME)
@Column(name = "`Time_with_time_zoneTest`", length = 21)
public Date getTimeWithTimeZoneTest() {
    return this.timeWithTimeZoneTest;
}

TIME WITH TIME ZONE

Time of day without time zone.

Storage: 8 bytes

Range: 00:00:00 - 24:00:00

Resolution: 1 microsecond / 14 digits

Hibernate default mapping

private Date timeWithoutTimeZoneTest;
@Temporal(TemporalType.TIME)
@Column(name = "`Time_without_time_zoneTest`", length = 15)
public Date getTimeWithoutTimeZoneTest() {
    return this.timeWithoutTimeZoneTest;
}

TIMESTAMP WITH TIME ZONE

Date and time with time zone.

Storage: 8 bytes

Range: 4713 BC - 294276 AD

Resolution: 1 microsecond / 14 digits

Hibernate default mapping

private Date timestampWithTimeZoneTest;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "`Timestamp_with_time_zoneTest`", length = 35)
public Date getTimestampWithTimeZoneTest() {
    return this.timestampWithTimeZoneTest;
}

TIMESTAMP WITHOUT TIME ZONE

Date and time without time zone.

Storage: 8 bytes

Range: 4713 BC - 294276 AD

Resolution: 1 microsecond / 14 digits

Hibernate default mapping

private Date timestampWithoutTimeZoneTest;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "`Timestamp_without_time_zoneTest`", length = 29)
public Date getTimestampWithoutTimeZoneTest() {
    return this.timestampWithoutTimeZoneTest;
}