Primary key length for long data type in Java (and Hibernate)?

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 Integerdo not lead to negative values ​​in the type Integer.

But 19 digits in Longcan cause a character overflow ... I usually see NUMBER(18)the type of column ID as ...

Is it possible to have a display issue NUMBER(19)in Longin Hibernate?

+5
source share
1 answer

Long - . , , . (, , ). Oracle NUMBER oracle.sql.NUMBER java.math.BigDecimal.

+2

All Articles