-->
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: How do I map a double type field to oracle NUMBER type
PostPosted: Thu Mar 22, 2007 3:00 pm 
Newbie

Joined: Tue May 04, 2004 3:32 pm
Posts: 16
Location: Iowa
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html



I have struggled for days getting a java.lang.Double filed mapped to oracle NUMBER type with precision 4 and scale 1.
I tried this:
<property name="validityAgreePercent" type="java.lang.Double">
<column name="ValidityAgreePercent" sql-type="NUMBER(4,1)" />
</property>
and

<property name="validityAgreePercent" type="double">
<column name="ValidityAgreePercent" sql-type="NUMBER(4,1)" />
</property>
and
<property name="validityAgreePercent" type="double">
<column name="ValidityAgreePercent" sql-type="NUMBER precision="4" and scale="1 " />

And over two dozen combinations.
None worked.

Does this validation have anything to do with jdbc driver?
My dialect is Oracle9Dialect.


I even tried big_decimal. It does not work either.
The same mapping works for sql-server where we have decimal in the database as a type.

Please help. I don't see any example.

I am bamming the wall right now.
</property>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 3:24 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
NUMBER is not a SQL type. NUMERIC is tho.

I'm pretty sure that the sql-type refers to java.sql.Types constants. I would have thought that just <property ... type="big_decimal"> would work. What error messages are you getting?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 4:50 pm 
Newbie

Joined: Tue May 04, 2004 3:32 pm
Posts: 16
Location: Iowa
I tried what you said as follows. No luck.
<property name="validityAgreePercent" type="big_decimal">
<column name="ValidityAgreePercent" />
</property>

org.hibernate.HibernateException: Wrong column type: ValidityAgreePercent, expected: decimal
at org.hibernate.mapping.Table.validateColumns(Table.java:205)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:956)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:299)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145)
at com.pearson.resource.adapter.jmx.jboss.hibernate.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:220)
at com.pearson.resource.adapter.jmx.jboss.hibernate.HibernateSessionFactory.startService(HibernateSessionFactory.java:100)
at com.pearson.epen.service.SessionFactoryDeployer.addSessionFactoryForDatasource(SessionFactoryDeployer.java:91)
at com.pearson.epen.service.DataSourceListener$DeployerThread.deploySessionFactory(DataSourceListener.java:416)
at com.pearson.epen.service.DataSourceListener$DeployerThread.run(DataSourceListener.java:393)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 23, 2007 12:44 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Hi ryang5,

try

<property name="validityAgreePercent" type="double" column ="ValidityAgreePercent" />

Not sure .If dosen't work use java 5

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 23, 2007 12:52 pm 
Newbie

Joined: Tue May 04, 2004 3:32 pm
Posts: 16
Location: Iowa
Tried that before. Not working.
I guess this has something to do with Oracle
see this link
http://opensource.atlassian.com/project ... bOQfxnxq-f

I am surprised this has not been fixed.


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.