Reputation: 48743
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?
Upvotes: 5
Views: 1736
Reputation: 5288
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.
Upvotes: 2