Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What column type should I use for BigInteger mapping in Hibernate?

I'm using Oracle XE database and annotation driven mapping. What column type should I choose for BigInteger value mapping in Hibernate?

like image 854
Pavel Avatar asked Mar 14 '23 18:03

Pavel


1 Answers

If you will see documentation it already mentioned

big_decimal, big_integer

Type mappings from java.math.BigDecimal and java.math.BigInteger to NUMERIC (or Oracle NUMBER).

here is an example which i got from Hibernate community

Hibernate 3.1.1 with Oracle 10g and XE. The script of my Table sample is this:

CREATE sample (
sampa NUMBER,
sampb NUMBER(5),
sampc NUMBER(10),
sampd NUMBER(15,2),
sampe NUMBER(19,7)
); 

and corresponding

<property name="sampa" column="sampa" type="java.math.BigInteger"/>
<property name="sampb" column="sampb" type="java.math.BigInteger"/>
<property name="sampc" column="sampc" type="java.math.BigInteger"/>
<property name="sampd" column="sampd" type="java.math.BigDecimal" precision="15" scale="2"/>
<property name="sampe" column="sampe" type="java.math.BigDecimal" precision="19" scale="7"/>
like image 200
Subodh Joshi Avatar answered Mar 23 '23 01:03

Subodh Joshi