-->
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: Numeric Overflow error : problem with Date field
PostPosted: Wed Oct 05, 2005 12:21 am 
Newbie

Joined: Wed Aug 31, 2005 8:18 pm
Posts: 18
My struts based application has a feature to search results by date.
When i perform the search, I am getting the following error:

JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Error: 17026, SQLState: null
JDBCException E org.hibernate.util.JDBCExceptionReporter Numeric Overflow

I am using java.util.Date as datatype for 'creationDate' field in my POJO, and timestamp as datatype in the mapping. I am working with Oracle.
I tried changing the datasource dialect from OracleDialect to Oracle9Dialect, but i stll get the same error.

The following is the code from my Action class:

if (request.getParameter("creationDate") != null && (request.getParameter("creationDate")).length() > 0) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
date = sdf.parse((String)request.getParameter("creationDate"));
}
catch (ParseException e) {
}
----
----
try {
session = PersistenceHelper.getNewSession();
Query query = session.getNamedQuery("com.entities.ac.ByDate");
query.setDate("date", date);
results = query.list();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
PersistenceHelper.closeSession(session);
} catch (HibernateException e) {
e.printStackTrace();
}
}
}

ac.hbm.xml

<hibernate-mapping>
<class name="com.entities.Ac" table="AC" lazy="false">
<id name="objectKey" type="long" column="OBJECT_KEY" unsaved-value="0" />
<property name="creationDate" type="timestamp" column="CREATION_DATE" />
<property name="withdrawalDate" type="date" column="WITHDRAWAL_DATE" />
</class>

<query name="com.entities.Ac.ByDate">
<![CDATA[
from com.entities.Ac as a
where a.creationDate >= to_date(:date, 'mm/dd/yyyy')
]]>
</query>
</hibernate-mapping>


hibernate.cfg.xml
<hibernate-configuration>
<session-factory>

<!-- Data Source -->
<property name="connection.datasource">java:comp/env/jdbc/PSOracle</property>
<property name="default_schema">PS_OWNER</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>

Generated SQL

select ac0_.OBJECT_KEY as OBJECT1_, ac0_.CREATION_DATE as CREATION4_9_, ac0_.WITHDRAWAL_DATE as WITHDRAWAL5_9_ from EPS_OWNER.AC ac0_ where ac0_.CREATION_DATE>=to_date('05/29/2005', 'mm/dd/yyyy')


Any help in solving this problem would be greatly appreciated.

Thanks,
Kum


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 12:00 pm 
Newbie

Joined: Wed Aug 31, 2005 8:18 pm
Posts: 18
I still get the same error.
any ideas please?

Thanks,
Kum


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 7:38 pm 
Beginner
Beginner

Joined: Mon Oct 11, 2004 2:22 am
Posts: 41
are you using oracle?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 8:26 pm 
Beginner
Beginner

Joined: Mon Oct 11, 2004 2:22 am
Posts: 41
ok, just solved the problem for me, which sounds very similar:

hibernate id generator was inserting the correct value into oracle via jdbc, however oracle was storing a scientific notation number (ie either extremely low or extremely high). this number was then being read back into jdbc and throwing the sql error "numeric overflow".

the culpret was: (drumroll) about a week ago i upgraded my oracle drivers to the ones supplied with oracle 10g because they claimed the drivers were backwards compatible. So, i switched back to the old drivers and everything works fine again.

So if you are using the new drivers (oracle jdbc drivers aka classes12.jar) revert back to the old version (in my case, the one supplied with oracle 8).

hope this helps.

IF IT DOES HELP, RATE MY RESPONSE. CHEERS.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:11 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try set date (or timestamp) in both (pojo and mapping)


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.