Reputation: 12621
i am using hibernate. it has id column with 20 precisions as below but of NUMBER type.
NUMBER(38,20) - this is the size given to id column of the table(Oracle database).
This id is generated by our application. in entity if i use Float or Double it cannot accommodate 20 precisions. but java.math.BigDecimal can accommodate these many precisions. but the problem is can i use BigDecimal in hbm as below? will there be any problems? some times i may not send id with precisions. that time will hibernate generates any empty precision and inserts?
<id name="someId" column="SOME_ID" type="java.math.BigDecimal"/>
Please suggest!
Upvotes: 11
Views: 5175
Reputation: 866
You can use type="big_decimal". Under no circumstances should you even attempt to use Float or Double for this.
Upvotes: 11