Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
PostgreSQLtype-mapping und EntityGeneratorCustomizerJAVA Beispielmoney
Data typeRapidClipse default mappingGenerated Javacode (example)

MONEY

Currency amount

Range: -92233720368547758.08

to +92233720368547758.07

Storage: 8 bytes

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

BIGINT

Large-range integer

Range: -9223372036854775808

to 9223372036854775807

Storage: 8 bytes

-

-

Hibernate default mapping

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

BIGSERIAL

Large autoincrementing integer

1 to 9223372036854775807

 Storage: 8 bytes

-

-

Hibernate default mapping

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

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

-

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

BYTEA

A variable-length binary string.

Storage: 1 or 4 bytes plus the

actual binary string.

-

-

Hibernate default mapping

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

CHARACTER

Character string with fixed-length

and blank padding.

-

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

CHARACTER VARYING

Character string with variable-length with

 limit.

-

Hibernate default mapping

-

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

DATE

Storage: 4 bytes

Range: 4713 BC - 5874897 AD

Resolution: 1 day

-

-

Hibernate default mapping

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

DOUBLE PRECISION

A user-specified precision, exact number

Range: 15 decimal digits precision

Storage: 8 bytes

-

-

Hibernate default mapping

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

INTEGER

A normal integer

Range: -2147483648 to +2147483647

Storage: 4 bytes

-

Hibernate default mapping

-

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

NUMERIC

A user-specified precision, exact number

Range: no limit

Storage: variable

-

-

Hibernate default mapping

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

REAL

A user-specified precision, exact number

Range: 6 decimal digits precision

Storage: 4 bytes

-

-

Hibernate default mapping

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

SERIAL

Autoincrementing integer

Range: 1 to 2147483647

Storage: 4 bytes

-

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

SMALLINT

Small-range integer

Range: -32768 to +32767

Storage: 2 bytes

-

-

Hibernate default mapping

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

TEXT

Character string with variable

unlimited length.

-

Hibernate default mapping

-

Code Block
languagejava
private BigDecimal moneyTest;
Code Block
languagejava
@Column(name = "`TextTest`")
public String getTextTest() {
	return this.textTest;
}
time with time zone

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

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

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

Code Block
languagejava
private Date timeWithoutTimeZoneTest;
Code Block
languagejava
@Temporal(TemporalType.TIME)
@Column(name = "`Time_without_time_zoneTest`", length = 15)
public Date getTimeWithoutTimeZoneTest() {
	return this.timeWithoutTimeZoneTest;
}
timestamp with time zone

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

-

Code Block
languagejava
private Date timestampWithTimeZoneTest;
Code Block
languagejava
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "`Timestamp_with_time_zoneTest`", length = 35)
public Date getTimestampWithTimeZoneTest() {
	return this.timestampWithTimeZoneTest;
}
timestamp without time zone

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

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