error saving object, IndexOutOfBoundsException ?

From: Arnaud GARCIA (arnaud.garci..im.hcuge.ch)
Date: Wed Aug 11 2004 - 04:16:04 EDT

  • Next message: Todd O'Bryan: "addToMany"

    Hello,

     

    We are evaluated Cayenne and we tried a simple program with a one to many
    relationship.

     

    When we save the object < Order> we have this error ., (I think Cayenne not
    load my DB relationships ?)

    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

          at java.util.ArrayList.RangeCheck(Unknown Source)

          at java.util.ArrayList.get(Unknown Source)

          at java.util.Collections$UnmodifiableList.get(Unknown Source)

          at
    org.objectstyle.cayenne.map.ObjRelationship.isToDependentEntity(ObjRelations
    hip.java:290)

          at
    org.objectstyle.cayenne.map.ObjRelationship.isSourceIndependentFromTargetCha
    nge(ObjRelationship.java:283)

          at
    org.objectstyle.cayenne.CayenneDataObject.validateForSave(CayenneDataObject.
    java:626)

          at
    org.objectstyle.cayenne.CayenneDataObject.validateForInsert(CayenneDataObjec
    t.java:674)

          at
    org.objectstyle.cayenne.access.ObjectStore.validateUncommittedObjects(Object
    Store.java:934)

          at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:12
    25)

          at
    ch.huge.risroutage.business.ColloqueDelegate.insertOrder(ColloqueDelegate.ja
    va:103)

          at
    ch.huge.risroutage.business.ColloqueDelegate.main(ColloqueDelegate.java:115)

    Exception in thread "main"

     

    We use cayenne-1.1B2,

    Any idea ?

     

    Thanks for help,

    Arnaud

     

     

    Here you will find my configuration :

     

    <?xml version="1.0" encoding="utf-8"?>

    <data-map project-version="1.1">

                <property name="defaultPackage" value="ch.hcuge.risroutage"/>

                <db-entity name="RIS_ORDER">

                            <db-attribute name="AETDESTINATION" type="VARCHAR"
    isMandatory="true" length="30"/>

                            <db-attribute name="AETSOURCE" type="VARCHAR"
    isMandatory="true" length="30"/>

                            <db-attribute name="CERTIFICATE" type="VARCHAR"
    length="255"/>

                            <db-attribute name="EVENTCODE" type="VARCHAR"
    length="30"/>

                            <db-attribute name="EVENTDATE" type="DATE"
    isMandatory="true"/>

                            <db-attribute name="EVENTID" type="VARCHAR"
    isPrimaryKey="true" isMandatory="true" length="30"/>

                            <db-attribute name="ORDERDATE" type="DATE"/>

                </db-entity>

                <db-entity name="RIS_SERIE">

                            <db-attribute name="EVENTID" type="VARCHAR"
    isPrimaryKey="true" isMandatory="true" length="30"/>

                            <db-attribute name="SERIESINSUID" type="VARCHAR"
    isPrimaryKey="true" isMandatory="true" length="255"/>

                </db-entity>

                <obj-entity name="Order" className="Order"
    dbEntityName="RIS_ORDER">

                            <obj-attribute name="aetDestination"
    type="java.lang.String" db-attribute-path="AETDESTINATION"/>

                            <obj-attribute name="aetSource"
    type="java.lang.String" db-attribute-path="AETSOURCE"/>

                            <obj-attribute name="certificate"
    type="java.lang.String" db-attribute-path="CERTIFICATE"/>

                            <obj-attribute name="eventCode"
    type="java.lang.String" db-attribute-path="EVENTCODE"/>

                            <obj-attribute name="eventDate" type="java.sql.Date"
    db-attribute-path="EVENTDATE"/>

                            <obj-attribute name="eventId"
    type="java.lang.String" lock="true" db-attribute-path="EVENTID"/>

                            <obj-attribute name="receivedDate"
    type="java.sql.Date" db-attribute-path="ORDERDATE"/>

                </obj-entity>

                <obj-entity name="Serie" className="Serie"
    dbEntityName="RIS_SERIE">

                            <obj-attribute name="seriesinsuid"
    type="java.lang.String" db-attribute-path="SERIESINSUID"/>

                </obj-entity>

                <db-relationship name="series" source="RIS_ORDER"
    target="RIS_SERIE" toMany="true">

                            <db-attribute-pair source="EVENTID"
    target="EVENTID"/>

                </db-relationship>

                <db-relationship name="order" source="RIS_SERIE"
    target="RIS_ORDER" toMany="false">

                            <db-attribute-pair source="EVENTID"
    target="EVENTID"/>

                </db-relationship>

                <obj-relationship name="series" source="Order" target="Serie"
    deleteRule="Cascade" db-relationship-path="series"/>

                <obj-relationship name="order" source="Serie" target="Order"
    db-relationship-path="order"/>

    </data-map



    This archive was generated by hypermail 2.0.0 : Wed Aug 11 2004 - 04:16:16 EDT