-->
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.  [ 2 posts ] 
Author Message
 Post subject: Oracle number maps to Bigdecimal
PostPosted: Tue Apr 15, 2008 5:23 am 
Newbie

Joined: Tue Oct 02, 2007 10:42 am
Posts: 10
All,

I am using Hibernate 3.2 with annotations and using an Oracle 10g database.

I read a legacy database table which has a column defined as a Number(6).

In my POJO class, if I map this column to a field of type Integer or Double, it doesnt work, it throws a ClassCastException. It works fine if I map it to a BigDecimal.

From the post at

http://forum.hibernate.org/viewtopic.php?t=967834&highlight=bigdecimal

I gather that Oracle Number types are always mapped to BigDecimal by hibernate. Is this true?
Because my confusion starts here. In my previous project (Which again used Hibernate with annotations), I had a table with a column declared as NUMBER(10) and that was mapped to a field of type Integer. That worked fine. So I am unable to figure out why this won't work.

Does anyone have any ideas?

In order to map a number to an Integer or Float and not a BigDecimal do any special annotations need to be specified? At present I am using just the @Column(name="name") annotation

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 15, 2008 5:33 pm 
Newbie

Joined: Mon Apr 14, 2008 11:24 am
Posts: 5
Look at
http://www.hibernate.org/hib_docs/v3/re ... pes-custom


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.