FAQ
[ https://issues.apache.org/cayenne/browse/CAY-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801#action_12801 ]

Adam Cornett commented on CAY-1017:
-----------------------------------

Sorry guys, I found the problem, there were some errors in my map.xml, this 'bug' can be closed/removed, I'll make sure to do a bit more digging next time.
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.

Search Discussions

  • Anonymous at Mar 27, 2008 at 7:24 am
    [ https://issues.apache.org/cayenne/browse/CAY-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Andrus Adamchik closed CAY-1017.
    --------------------------------

    Resolution: Cannot Reproduce
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedMar 27, '08 at 3:31a
activeMar 27, '08 at 7:24a
posts2
users1
websitecayenne.apache.org

1 user in discussion

Anonymous: 2 posts

People

Translate

site design / logo © 2022 Grokbase