Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
305
Mapping documents:
Quote:
<hibernate-mapping>
<class name="cat.eur.fq.bnrrnb.model.Transaction" table="ZT_REC_INTERPLNT" schema="AN0FQ002">
<id name="ident" column="IDENT" type="java.lang.Long" length="11" />
<property (...) />
<filter name="instance" condition=" RCV_FAC_CD = :instanceFacility "/>
</class>
<filter-def name="instance">
<filter-param name="instanceFacility" type="string"/>
</filter-def>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Quote:
.enableFilter("instance")
.setParameter("instanceFacility", "37")
Full stack trace of any exception that occurs:Quote:
[2005-09-26 14:00:33.022] -1 INFORMATIONAL DBStatement logDebugSQLString select distinct abstractmo0_.SHP_FAC_CD as col_0_0_ from AN0FQ002.ZT_REC_INTERPLNT abstractmo0_ where abstractmo0_.RCV_FAC_CD = '37' and abstractmo0_.MVNT='RCVG'
[2005-09-26 14:00:33.173] 0 FATAL org.hibernate.util.JDBCExceptionReporter java [IBM][JDBC Driver] CLI0612E Invalid parameter number. SQLSTATE=S1093
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:1502)
at org.hibernate.loader.Loader.list(Loader.java:1482)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at cat.eur.fq.bnrrnb.dao.BnrRnbDAOImp.getFacilitiesForMovement(BnrRnbDAOImp.java:63)
at cat.eur.fq.bnrrnb.tests.dao.BnrRnbDAOImpTest.testGetFacilitiesForMovement(BnrRnbDAOImpTest.java:27)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at cat.euro.test.TUFHbmAbstractTestCase.runTest(TUFHbmAbstractTestCase.java:127)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0612E Invalid parameter number. SQLSTATE=S1093
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwParamIndexError(SQLExceptionGenerator.java:626)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.setString(DB2PreparedStatement.java:2748)
at cat.cis.tuf.server.connector.jdbc.v1.JDBCv1DBStatement.setString(JDBCv1DBStatement.java:1113)
at org.hibernate.type.StringType.set(StringType.java:24)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
at org.hibernate.loader.hql.QueryLoader.bindNamedParameters(QueryLoader.java:232)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1101)
at org.hibernate.loader.Loader.doQuery(Loader.java:362)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.doList(Loader.java:1499)
... 20 more
Name and version of the database you are using:
DB2V7
The generated SQL (show_sql=true):
select distinct abstractmo0_.SHP_FAC_CD as col_0_0_ from AN0FQ002.ZT_REC_INTERPLNT abstractmo0_ where abstractmo0_.RCV_FAC_CD = '37' and abstractmo0_.MVNT='RCVG'
SO! after all taht, here is my problem:
I try to use the filter at session creation. So I set it.
But, with it set, I get a JDBC error althought the sql statement is ok.
I get a "[IBM][JDBC Driver] CLI0612E Invalid parameter number. SQLSTATE=S1093"...
If I disable the filter, it works fine.
Thanks in advance for any help.