Hibernate version: 3.1.2
Mapping documents:
<hibernate-mapping>
<class name="combase.korona.fach.datamodel.Organisationseinheit" table="ORG">
<!-- <cache usage="read-write" /> -->
<id name="id" type="long" unsaved-value="-1">
<column name="PK_ORG_ID" sql-type="long" not-null="true" />
<generator class="sequence">
<param name="sequence">GEN_KEYS</param>
</generator>
</id>
....
<property name="lager"/>
...
</class>
<query name="Organisationseinheit.findLager">
<![CDATA[
from Organisationseinheit org where lager is true
]]>
</query>
Full stack trace of any exception that occurs:
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select organisati0_.PK_ORG_ID as PK1_20_, organisati0_.GEAENDERT as GEAENDERT20_, organisati0_.bezeichnung as bezeichn3_20_, organisati0_.FK_REPORTKONTO_ID as FK4_20_, organisati0_.FK_ORG_ID as FK5_20_, organisati0_.nummer as nummer20_, organisati0_.kurznummer as kurznummer20_, organisati0_.strasse as strasse20_, organisati0_.plz as plz20_, organisati0_.ort as ort20_, organisati0_.mail as mail20_, organisati0_.TEL as TEL20_, organisati0_.fax as fax20_, organisati0_.ansprechpartner as ansprec14_20_, organisati0_.mitarbeiter as mitarbe15_20_, organisati0_.fixkosten as fixkosten20_, organisati0_.handlungskosten as handlun17_20_, organisati0_.kontaktstrecke as kontakt18_20_, organisati0_.praesentationsflaeche as praesen19_20_, organisati0_.konzernzugehoerigkeit as konzern24_20_, organisati0_.GUELTIG_AB as GUELTIG20_20_, organisati0_.GUELTIG_BIS as GUELTIG21_20_, organisati0_.FK_ORGTYP_ID as FK23_20_, organisati0_.FK_SYSTEMGEBER_ID as FK25_20_, organisati0_.FK_MIETEINHEITSTYP_ID as FK26_20_, organisati0_.PACHTSATZ as PACHTSATZ20_, organisati0_.SYSTEMGEBUEHR as SYSTEMG28_20_, organisati0_.SERWAYBETRIEB as SERWAYB29_20_, organisati0_.lager as lager20_ from ORG organisati0_ where organisati0_.lager=1]; SQL state [HY000]; error code [335544334]; GDS Exception. 335544334. conversion error from string "Y"; nested exception is org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544334. conversion error from string "Y"
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544334. conversion error from string "Y"
at org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:206)
at org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:119)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:250)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:168)
at org.hibernate.loader.Loader.doQuery(Loader.java:685)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:920)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:911)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:903)
at combase.korona.storage.hibernate.current.HibernateBaseDAO.findByNamedQuery(HibernateBaseDAO.java:138)
at combase.korona.storage.hibernate.current.HibernateStoragemanager.findByNamedQuery(HibernateStoragemanager.java:100)
at combase.korona.fach.services.ApplicationService.findByNamedQuery(ApplicationService.java:849)
at combase.korona.webui.forms.ArtikelForm.putBestaende(ArtikelForm.java:1420)
at combase.korona.webui.forms.ArtikelForm.putDataObject(ArtikelForm.java:1285)
at combase.korona.tankrast.shared.webui.forms.ArtikelForm.putDataObject(ArtikelForm.java:146)
at combase.korona.webui.forms.ArtikelForm.putDataObject(ArtikelForm.java:1)
at combase.korona.webui.actions.ObjectAction.createView(ObjectAction.java:197)
at combase.korona.webui.actions.ObjectAction.executeEditAction(ObjectAction.java:289)
at combase.korona.webui.actions.ObjectAction.executeStxxAction(ObjectAction.java:104)
at combase.korona.webui.actions.StxxActionBase.executeKoronaAction(StxxActionBase.java:67)
at combase.korona.webui.shared.KoronaActionBase.executeUserAction(KoronaActionBase.java:39)
at combase.korona.webui.shared.UserAction.executeAction(UserAction.java:61)
at combase.korona.webui.shared.ActionBase.execute(ActionBase.java:45)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
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 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
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)
at org.firebirdsql.gds.GDSException: conversion error from string "Y"
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2104)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2054)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlFetch(AbstractJavaGDSImpl.java:1322)
at org.firebirdsql.gds.impl.GDSHelper.fetch(GDSHelper.java:260)
at org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:201)
at org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:119)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:250)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:168)
at org.hibernate.loader.Loader.doQuery(Loader.java:685)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:920)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:911)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:903)
at combase.korona.storage.hibernate.current.HibernateBaseDAO.findByNamedQuery(HibernateBaseDAO.java:138)
at combase.korona.storage.hibernate.current.HibernateStoragemanager.findByNamedQuery(HibernateStoragemanager.java:100)
at combase.korona.fach.services.ApplicationService.findByNamedQuery(ApplicationService.java:849)
at combase.korona.webui.forms.ArtikelForm.putBestaende(ArtikelForm.java:1420)
at combase.korona.webui.forms.ArtikelForm.putDataObject(ArtikelForm.java:1285)
at combase.korona.tankrast.shared.webui.forms.ArtikelForm.putDataObject(ArtikelForm.java:146)
at combase.korona.webui.forms.ArtikelForm.putDataObject(ArtikelForm.java:1)
at combase.korona.webui.actions.ObjectAction.createView(ObjectAction.java:197)
at combase.korona.webui.actions.ObjectAction.executeEditAction(ObjectAction.java:289)
at combase.korona.webui.actions.ObjectAction.executeStxxAction(ObjectAction.java:104)
at combase.korona.webui.actions.StxxActionBase.executeKoronaAction(StxxActionBase.java:67)
at combase.korona.webui.shared.KoronaActionBase.executeUserAction(KoronaActionBase.java:39)
at combase.korona.webui.shared.UserAction.executeAction(UserAction.java:61)
at combase.korona.webui.shared.ActionBase.execute(ActionBase.java:45)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
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 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
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)
Name and version of the database you are using:
Firebird 1.5 / jaybird jdbc driver
The generated SQL (show_sql=true):
select ... from ORG organisati0_ where organisati0_.lager=1
So here is my problem:
Class Organisationseinheit has a property "lager" of type "Boolean". The corresponding table stores this in a field of type char(1). When storing and loading Organisationseinheit Objects, the JDBC Driver maps true to 'Y' and false to 'N'. This is all working well, hibernate just uses the jdbc driver for this. Now i introduced a query like this:
"from Organisationseinheit org where org.lager is true"
And suddenly, hibernate tries to get smart itself and produces this sql for the hql query:
select ... from ORG organisati0_ where organisati0_.lager=1
it uses an integer value (1 instead of '1') which is wrong and it uses the wrong semantics (1 instead of 'Y').
Now some RDBMs would balk at this because an integer is passed for a character field, and some (including firebird) try to compare the 'Y's and 'N's in the table to an integer and fail with an conversion error (see above). Changing the field type in the database is not an option, because i do not have control over this.
|