db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Possible bug in PreparedStatement ?
Date Sun, 11 Dec 2005 21:55:34 GMT
While sitting here with Jean at the Hackathon and adding support for
Derby to OJB, I stumbled across a strange exception that might perhaps
be a bug. In short, OJB generates some SQL like this (don't ask):

SELECT A0.TASK_ID,A0.PERSON_ID,A0.PROJECT_ID,A0.TASKNAME FROM TASK A0
WHERE (A0.PERSON_ID = ?) AND A0.PROJECT_ID = ? OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?)
OR  ((A0.PERSON_ID = ?) AND A0.PROJECT_ID = ?) OR  ((A0.PERSON_ID = ?)
AND A0.PROJECT_ID = ?)

(yes, its strange).
Now that seems to hit some boundary because Derby complains with this exception:

* Exception message is [Cannot create an instance of generated class
org.apache.derby.exe.ac601a400fx0108x1bc2x20e7x0000000ddc4833.]
* Vendor error code [30000]
* SQL state code [XBCM2]
L state code [XBCM2]
	at org.apache.ojb.broker.util.ExceptionHelper.generateException(ExceptionHelper.java:256)
	at org.apache.ojb.broker.util.ExceptionHelper.generateException(ExceptionHelper.java:53)
	at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(StatementsForClassImpl.java:176)
	at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(StatementManager.java:609)
	at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:270)
	at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:72)
	at org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:187)
	at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:2070)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1628)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorByQuery(PersistenceBrokerImpl.java:1615)
	at org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(BasePrefetcher.java:104)
	at org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryReferenceBroker.java:381)
	at org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(BasePrefetcher.java:113)
	at org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryReferenceBroker.java:381)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:176)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:263)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:289)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1484)
	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:383)
	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:383)
	at org.apache.ojb.broker.QueryTest.testLikeCriteria(QueryTest.java:407)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	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:478)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: SQL Exception: Cannot create an instance of generated class
org.apache.derby.exe.ac601a400fx0108x1bc2x20e7x0000000ddc4833.
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
	at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
	at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(StatementsForClassImpl.java:287)
	at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(StatementsForClassImpl.java:171)
	... 34 more



Running the query in ij produces the same error, but after we removed
a couple of thos OR clauses, it ran through, so it seems there is some
sort of limit in there somewhere.

regards
Tom

Mime
View raw message