These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Hibernate mapping type (Oracle NUMBER)
PostPosted: Mon May 08, 2006 1:21 pm 
Newbie

Joined: Mon May 08, 2006 1:11 pm
Posts: 7
Hi,

I am using 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)
);

As I should map Fields NUMBER to Java in Hibernate?
Option 1)
---------
sampa NUMBER -- > java.math.BigDecimal
sampb NUMBER(5), -- > java.lang.Integer
sampc NUMBER(10), -- > java.lang.Integer
sampd NUMBER(15,2), -- > java.lang.Float
sampe NUMBER(19,7) -- > java.lang.Long

or
Option 2)
---------
ALL FIELDS NUMBER should be used with -- > java.math.BigDecimal


Regards.

Sergio.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 1:44 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Code:
<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"/>


Top
 Profile  
 
 Post subject: Hibernate mapping type (Oracle NUMBER)
PostPosted: Mon May 08, 2006 4:38 pm 
Newbie

Joined: Mon May 08, 2006 1:11 pm
Posts: 7
Hi bkmr_77,

Thank you for their quick answer.

Then I should assume that if I use
until NUMBER(38,0) ---> type="java.math.BigInteger"
until NUMBER(38,38) ---> type="java.math.BigDecimal" precision="38" scale="38"
and NUMBER ---> type="java.math.BigDecimal"

Is this range the Correct one?

For Last, where I find documentation on the topic? .

Thank you again.

Regards.

Sergio.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 4:51 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
I guess the previous post of mine should be as follows

Code:
<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" length="15" precision="2"/>
<property name="sampe" column="sampe" type="java.math.BigDecimal" length="19" precision="7"/>


sorry I am confused, couldnt find any documentation information regarding this. Dont know which attributes are correct. If the ones mentioned in the first post worked, please let me know. Thanks.


Top
 Profile  
 
 Post subject: Hibernate mapping type (Oracle NUMBER)
PostPosted: Mon May 08, 2006 7:26 pm 
Newbie

Joined: Mon May 08, 2006 1:11 pm
Posts: 7
Hi,

Forgive, Their first post worked well.

Now, I need to know the ranges for map Fields NUMBER to Java in Hibernate.

Exists Documentation on the ranges for map Fields NUMBER to Java in Hibernate?.

These ranges, are the correct ones?
until NUMBER(38,0) I should use ---> type="java.math.BigInteger" (All the Integers you mapping like BigInteger?)
until NUMBER(38,38) I should use ---> type="java.math.BigDecimal" precision="38" scale="38"
and NUMBER I should use ---> type="java.math.BigDecimal"


Do you understand my Question?

Thank you !!

Regards.

Sergio.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.