Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

PostgreSQLtype-mapping und EntityGeneratorCustomizerJAVA Beispiel

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

-

-

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

bigserial

Large autoincrementing integer

1 to 9223372036854775807

 Storage: 8 bytes

-

-

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

boolean

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.

-

-

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.

-

-

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.

-

-

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

-

-

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

-

-

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

-

-

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

numeric

A user-specified precision, exact number

Range: no limit

Storage: variable

-

-

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

-

-

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

-

-

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

text

Character string with variable

unlimited length.

-

-

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

-

-

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

time without time zone

Time of day without time zone.

Storage: 8 bytes

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

Resolution: 1 microsecond / 14 digits

-

-

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

-

-

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

-

-

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

  • No labels