-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Generation identifier with hi/lo --> overflow !
PostPosted: Wed Oct 12, 2005 1:39 pm 
Newbie

Joined: Thu Jun 10, 2004 5:37 am
Posts: 19
Hibernate version:
2.0

Mapping documents:
<class name="ogde.dao.hbbean.HbImportHistoric" table="IMPORT_HISTORIC">
<meta attribute="implements">Comparable</meta>
<id name="id" column="id_import" type="long">
<generator class="hilo" />
</id>
<discriminator />
<version column="optimist_lock" name="optimistLock" type="long" />
<property name="programName" column="program_name" type="string" />
<property name="devstepName" column="devstep_name" type="string" />
<property name="folderName" column="folder_name" type="string" />
<property name="dateImport" column="date_import" type="java.util.Date" />
<property name="userImport" column="user_import" type="string" />
<property name="fileName" column="file_name" type="string" />

</class>

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

Full stack trace of any exception that occurs:
15:43:10,322 DEBUG HbSessionFactoryRepository.getNewSession():254 - Session ouverte sur la l'alias Database : maDb
15:43:10,332 DEBUG HbSessionFactoryRepository.getNewSession():254 - Session ouverte sur la l'alias Database : maDb
15:43:10,339 WARN JDBCExceptionReporter.logExceptions():38 - SQL Error: 0, SQLState: null
15:43:10,340 ERROR JDBCExceptionReporter.logExceptions():46 - Overflow Exception
15:43:10,342 WARN JDBCExceptionReporter.logExceptions():38 - SQL Error: 0, SQLState: null
15:43:10,343 ERROR JDBCExceptionReporter.logExceptions():46 - Overflow Exception
15:43:10,347 ERROR JDBCExceptionReporter.<init>():38 - Could not execute query
java.sql.SQLException: Overflow Exception
at oracle.sql.NUMBER.toLong(NUMBER.java:376)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(DBConversion.java:2915)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4562)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:555)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1536)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1513)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1505)
at sopra.twork.dao.hibernate.template.AtomicHibernateTemplate.find(AtomicHibernateTemplate.java:610)
at sopra.twork.dao.hibernate.template.HibernateDao.find(HibernateDao.java:336)
at ogde.dao.persistence.DaoHbImportHistoric.findAll(DaoHbImportHistoric.java:30)
at imports.ImportAction.displayImportHistoric(ImportAction.java:340)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sopra.twork.struts.action.DispatchAction.dispatchMethod(DispatchAction.java:325)
at sopra.twork.struts.action.AnyDispatchAction.execute(AnyDispatchAction.java:42)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at sopra.twork.struts.role.AbstractUserFilter.doFilter(AbstractUserFilter.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
15:43:10,363 DEBUG GenericExceptionHandlerForStruts.execute():92 - l'exception levée est de type : sopra.twork.dao.exception.DaoException
15:43:10,364 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():141 - l'exception levée est de type : GenericException
15:43:10,411 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():153 - nom long de l'Exception :sopra.twork.dao.exception.DaoException
15:43:10,411 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():154 - nom court de l'Exception :Dao
15:43:10,412 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():155 - premiere identification :Dao-HIBERNATE-007
15:43:10,413 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():156 - deuxième identification :Dao-HIBERNATE
15:43:10,414 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():157 - troisième identification :Dao
15:43:10,417 DEBUG GenericExceptionHandlerForStruts.getMessageForKey():241 - global niveau d'information
15:43:10,418 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():178 - le message user est :Une Erreur est survenue (captée par le &lt;global-exceptions&gt; Struts)
15:43:10,419 DEBUG GenericExceptionHandlerForStruts.processMessageForJsp():190 - stack required!!
15:43:10,423 ERROR GenericExceptionHandlerForStruts.processLogTrace():199 -
0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0!!!!!!!!!!!!!!!!! DEBUT ERREUR
0 DETAIL DES INFORMATIONS DE L'sopra.twork.dao.exception.DaoException
0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0 Classe = AtomicHibernateTemplate
0 Méthode = find
0 Code = HIBERNATE-007
0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0 StackTrace de l'exception :
0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0 sopra.twork.dao.exception.DaoException:
0 message : Erreur en find sur la query FROM HbImportHistoric histo ORDER BY histo.dateImport DESC et Valeur(s) {1} et Type(s) {2}
0 at sopra.twork.dao.hibernate.template.AtomicHibernateTemplate.find(AtomicHibernateTemplate.java:612)
0 at sopra.twork.dao.hibernate.template.HibernateDao.find(HibernateDao.java:336)
0 at ogde.dao.persistence.DaoHbImportHistoric.findAll(DaoHbImportHistoric.java:30)
0 at imports.ImportAction.displayImportHistoric(ImportAction.java:340)
0 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
0 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
0 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
0 at java.lang.reflect.Method.invoke(Method.java:324)
0 at sopra.twork.struts.action.DispatchAction.dispatchMethod(DispatchAction.java:325)
0 at sopra.twork.struts.action.AnyDispatchAction.execute(AnyDispatchAction.java:42)
0 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
0 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
0 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
0 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
0 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
0 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

...

Name and version of the database you are using:
Oracle 9i

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
----------


I've got a problem with the generator hi/lo, but I can't see the problem on my own PC, it happens only with customer database and I haven't access to it rigth now.

When I make insert on the table IMPORT_HISTORIC we can see that id_import generated by hi/lo generator is 0 * 10^-16 or 145656561556565 I mean a value that can be treated by oracle but that can't be converted to a long in Java (overflow).

The generator hi/lo take a next_hi value in a HIBERNATE_UNIQUE_KEY and this value is 336 (thus it seems good).

I can't say if it's a customer database problem or if it's the Hibernate Hi/Lo which encounter a problem...

Do have an idea what can cause such a problem ?


Thank you very much for your help !


Nicolas


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 9:13 am 
Newbie

Joined: Thu Jun 10, 2004 5:37 am
Posts: 19
wanton wrote:
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.


Maybe it's the solution,
I'm using Oracle 8.1.7 and the driver ojdbc14.jar (for Oracle 9.0.2). I saw that there is a driver for Oracle 8.1.7, but this driver is for JDK 1.2 but I'm using JDK 1.4 then I can't try your solution...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.