Hi all,
I've got a problem with a HQL Query. I'm using PostgreSQL 8.1 and Hibernate 3.0.5.
The query is :
SELECT ap_tipo_estudio.descripcion as tipoEstudio,
COUNT(*) as numeroEstudios,
(
AVG( ap_estudios.fecSalida - ap_estudios.fecPeti )
) as demoraMedia
FROM ...
WHERE ...
GROUP BY ...
ORDER BY ...
The bold text returns a postgresql interval type. When Hibernate try to map the value to a hibernate type the system throws an exception like this :
Hibernate: select aptipoestu1_.descripcion as col_0_0_, count(*) as col_1_0_, AVG(apestudios0_.fec_salida-apestudios0_.fec_peti) as col_2_0_ from ap_estudios apestudios0_, ap_tipo_estudio aptipoestu1_ where apestudios0_.tipo_estudio=aptipoestu1_.codigo and apestudios0_.estado_actual='02' and (apestudios0_.fec_salida between ? and ?) group by aptipoestu1_.descripcion order by aptipoestu1_.descripcion
WARN - SQL Error: 0, SQLState: 22007
ERROR - Bad value for type timestamp : [C@1d128b6
ERROR - Error general - could not execute query
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at net.sf.jasperreports.engine.query.JRHibernateQueryExecuter.list(JRHibernateQueryExecuter.java:378)
at net.sf.jasperreports.engine.data.JRHibernateListDataSource.fetchPage(JRHibernateListDataSource.java:67)
at net.sf.jasperreports.engine.data.JRHibernateListDataSource.<init>(JRHibernateListDataSource.java:60)
at net.sf.jasperreports.engine.query.JRHibernateQueryExecuter.createResultDatasource(JRHibernateQueryExecuter.java:160)
at net.sf.jasperreports.engine.query.JRHibernateQueryExecuter.createDatasource(JRHibernateQueryExecuter.java:129)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:671)
at net.sf.jasperreports.engine.fill.JRFillDataset.setDatasource(JRFillDataset.java:615)
at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:604)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:871)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:689)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:123)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:420)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:256)
at es.ingenia.infopat.informes.StaDemMediaConFestivos.fillReport(StaDemMediaConFestivos.java:44)
at es.ingenia.infopat.informes.ReportManager.fillReport(ReportManager.java:111)
at es.ingenia.infopat.informes.MnemonicoInforme.generarJasperPrint(MnemonicoInforme.java:118)
at es.ingenia.infopat.struts.action.informes.ProcesaInformesAction.execute(ProcesaInformesAction.java:81)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at es.ingenia.infopat.filters.HibernateThreadTransactionFilter.doFilter(HibernateThreadTransactionFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.postgresql.util.PSQLException: Bad value for type timestamp : [C@1d128b6
at org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:232)
at org.postgresql.jdbc2.TimestampUtils.toTimestamp(TimestampUtils.java:307)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:419)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2245)
at org.hibernate.type.TimestampType.get(TimestampType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.loader.hql.QueryLoader.getResultColumnOrRow(QueryLoader.java:357)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:329)
at org.hibernate.loader.Loader.doQuery(Loader.java:412)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
... 45 more
Caused by: java.lang.NumberFormatException: Expected time to be colon-separated, got ' '
at org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:151)
... 56 more
Any idea?
Thanks in advance.
_________________ Best regards,
Justo Aguilar
|