log(2^32) / log(10) =~ 9.63295986126 log(10^0.63295986126) / log(2) =~ 2.10264714605 > 2 bit log(2^64) / log(10) =~ 19.2659197225 log(10^0.2659197225) / log(2) =~ 0.883366197155 < 2 bit
As you can see 9 digits for Integer
doesn't lead to negative values in Integer
type.
But 19 digits in Long
can cause sign overflow... I usually see NUMBER(18)
as type of ID column...
Is it possible to have problem with mapping NUMBER(19)
to Long
in Hibernate?
Do not use Long - it's intended for numbers. You never multiply, add, subtract PKs. (you probably even never sort them). For Oracle datatype NUMBER use either oracle.sql.NUMBER or java.math.BigDecimal.
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.