简体   繁体   中英

Correct column types in Oracle and PostgreSQL for Java(Hibernate) Float type

I need create column for storage Float value in Oracle and PostgreSQL.

@Column(name = "SOME_VALUE")
private Float someValue;

How do I create columns in both bases so that Hibernate is mapping normally?

I tried the FLOAT type in Oracle (and it work) and BIGINT in PostgresSQL.

But I am confused by my choice. I want the most correct types for both databases.

For Oracle:

use NUMBER for arbitrary precision (if you can't afford rounding errors, for example with money) or BINARY_DOUBLE for faster processing, if rounding errors don't matter so much, like a temperature measurement.

For PostgreSQL:

The corresponding data types in PostgreSQL would be numeric and double precision .

FLOAT in Oracle is the same as NUMBER with a precision limit in binary digits, and bigint in PostgresSQL is for large integer numbers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM