[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2445) Wrong data type used for MySQL timestampdiff(FRAC_SECOND, date1, date2)

Don Smith (JIRA) noreply at atlassian.com
Fri Feb 23 19:20:31 EST 2007


Wrong data type used for MySQL timestampdiff(FRAC_SECOND, date1, date2)
-----------------------------------------------------------------------

         Key: HHH-2445
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2445
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.0.ga    
 Environment: MySQL 5.0.27, Connector/J 5.0.4, SUSE Linux Enterprise Desktop 10
    Reporter: Don Smith


The following HQL
List results = executeQuery("select timestampdiff(FRAC_SECOND, startDate, endDate) from IntervalTracker order by id");

throws this stack trace:

org.hibernate.exception.DataException: could not execute query
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.loader.Loader.doList(Loader.java:2211)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2092)
	at org.hibernate.loader.Loader.list(Loader.java:2087)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
	at com.novell.soa.persist.HibernateDateDiffTest.executeQuery(HibernateDateDiffTest.java:152)
	at com.novell.soa.persist.HibernateDateDiffTest.testDateDiff(HibernateDateDiffTest.java:121)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
	at junit.extensions.TestSetup.run(TestSetup.java:23)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: com.mysql.jdbc.exceptions.MySQLDataException: '3605940000000' in column '1' is outside valid range for the datatype INTEGER.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:893)
	at com.mysql.jdbc.ResultSet.throwRangeException(ResultSet.java:7391)
	at com.mysql.jdbc.ResultSet.getNativeInt(ResultSet.java:3967)
	at com.mysql.jdbc.ResultSet.getNativeInt(ResultSet.java:3892)
	at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2555)
	at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2570)
	at org.hibernate.type.IntegerType.get(IntegerType.java:28)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:161)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:150)
	at org.hibernate.loader.hql.QueryLoader.getResultColumnOrRow(QueryLoader.java:333)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:594)
	at org.hibernate.loader.Loader.doQuery(Loader.java:689)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
	at org.hibernate.loader.Loader.doList(Loader.java:2208)
	... 38 more



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list