<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>
.enableFilter("instance")
.setParameter("instanceFacility", "37")
[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
Originally posted by pascal betz:
my 2 cents:
NOTE: Does not work with collections (at least in Hibernate 2, i do not know if Hibernate 3 can handle them).
You can use [url=http://"http://www.hibernate.org/hib_docs/api/net/sf/hibernate/Criteria.html"]setFetchMode()[/url] , eager fetching in HQL, outer join settings to control the way collections are loaded.
pascal