IndexOutOfBoundsException with Postgres Named Query
---------------------------------------------------
Key: CAY-1017
URL: https://issues.apache.org/cayenne/browse/CAY-1017
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 3.0
Environment: Linux ajc-laptop 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
Postgres 8.2 with the latest JDBC driver
Reporter: Adam Cornett
Assignee: Andrus Adamchik
I get the following error when I attempt to run a simple NamedQuery:
ERROR:
INFO Thread-9 org.apache.cayenne.access.QueryLogger.logQueryStart(QueryLogger.java:449)- --- will run 1 query.
INFO Thread-9 org.apache.cayenne.access.QueryLogger.logBeginTransaction(QueryLogger.java:403)- --- transaction started.
INFO Thread-9 org.apache.cayenne.access.QueryLogger.logQueryError(QueryLogger.java:429)- *** error.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at java.util.Collections$UnmodifiableList.get(Collections.java:1154)
at org.apache.cayenne.access.trans.SelectTranslator$1.visitRelationship(SelectTranslator.java:337)
at org.apache.cayenne.access.trans.SelectTranslator$1.visitToOne(SelectTranslator.java:331)
at org.apache.cayenne.reflect.generic.DataObjectToOneProperty.visit(DataObjectToOneProperty.java:88)
at org.apache.cayenne.reflect.PersistentDescriptor.visitDeclaredProperties(PersistentDescriptor.java:339)
at org.apache.cayenne.reflect.PersistentDescriptor.visitProperties(PersistentDescriptor.java:372)
at org.apache.cayenne.reflect.PersistentDescriptor.visitAllProperties(PersistentDescriptor.java:351)
at org.apache.cayenne.reflect.LazyClassDescriptorDecorator.visitAllProperties(LazyClassDescriptorDecorator.java:166)
at org.apache.cayenne.access.trans.SelectTranslator.appendQueryColumns(SelectTranslator.java:350)
at org.apache.cayenne.access.trans.SelectTranslator.buildResultColumns(SelectTranslator.java:270)
at org.apache.cayenne.access.trans.SelectTranslator.createSqlString(SelectTranslator.java:107)
at org.apache.cayenne.dba.postgres.PostgresSelectTranslator.createSqlString(PostgresSelectTranslator.java:32)
at org.apache.cayenne.access.trans.QueryAssembler.createStatement(QueryAssembler.java:96)
at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:58)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:230)
at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:442)
at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:67)
at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:415)
at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:847)
at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:412)
at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:119)
at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:740)
at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:296)
at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:84)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1331)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1320)
at net.codescore.managers.TeamManager.getSchoolByName(Unknown Source)
at net.codescore.managers.TeamManager.getTeamByName(Unknown Source)
at net.codescore.ui.client.TeamLoader._TESTING_HACK(Unknown Source)
at net.codescore.ui.client.TeamLoader.onCreate(Unknown Source)
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:597)
at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:209)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:143)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:483)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:419)
QUERY:
<query name="school_by_name" factory="org.apache.cayenne.map.SelectQueryBuilder" root="obj-entity" root-name="School">
<qualifier><![CDATA[name = $n]]></qualifier>
</query>
I can provide more code or my Cayenne xml files if needed.
I just moved the DB from MySQL to Postgres and it can select and commit other objects from the database using named queries, but this one fails, I cannot isolate the problem in my code, so I'm passing it along. If you would like to see the code, visit https://code.launchpad.net/codescore, or feel free to e-mail me.
-- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
This archive was generated by hypermail 2.0.0 : Wed Mar 26 2008 - 22:32:04 EDT