-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: filter => invalid parameter number ?! o_Ô
PostPosted: Mon Sep 26, 2005 8:32 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 8:54 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
trying to debbug that, it appears that the parameter number IS invalid :-).

it is correct one + 1 (should be 2, is 3)... Am I doing somthing wrong ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 10:53 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
up...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 3:37 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
a last up before I suicide....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 3:58 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Wow ... I've never seen a quadruple poster before.

If the SQL produced by H is good as you say, and your getting a JDBC exception, then you may want to try a different driver.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 4:54 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
I doubt it, because, H seems to try to add the filter twice, that's what crashes, and that's why the JDBC Driver receive too many parameters

thanks anyway


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 12:12 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
wouldn't that mean the where clause would appear twice?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 4:57 pm 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
it is not about the where clause, but just the attribute. If it was present twice in the where clause, there would not be any problem. But there, it is present only once in the where clause, but twice in the parameters (as far as I can see), then, there is one extra parameter, that the jdbc drivers refuses...

those are just my thought, from what I saw trying to degubb that...

and, as you can see on the left, I'm just a beginner :)

thanks for the help


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 10:45 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
Ok....

With DB2v7,there are two version of the driver: JDBCv1, and v2. The v2 works like a charm :-/

So it really was a JDBC driver problem...

Sorry to have not trust you dennis..

does you have a cliff I could jump off ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.