Hi,

Thanks. Got that problem solved. It works fine when i map a compound primary
key from one table to another with a single primary key. However when i map
compound primary keys to compound primary keys, i get a NullPointerException
which results from [org.apache.ojb.broker.accesslayer.IndirectionHandler]
ERROR: Met.....


e.g Table A:
<class-descriptor
    class = "com.data.A"
 proxy="dynamic"
 table = "Shipment">
    <field-descriptor id = "1"
  name = "shipmentOid"
  column = "SHIPMENT_OID"
  jdbc-type ="INTEGER"
  primarykey = "true"
    />
    <field-descriptor id = "2"
  name = "countryCode"
  column = "REF_COUNTRY_CD"
  jdbc-type ="VARCHAR"
  primarykey = "true"
    />
....

    <reference-descriptor
  name="piece"
  class-ref="com.data.B"
  proxy="true">
  <foreignkey field-id-ref="1"/>
  <foreignkey field-id-ref="2"/>
    </reference-descriptor>
</class-descriptor>

Table B:

<class-descriptor
    class = "com.data.B"
 proxy="dynamic"
 table = "Piece">
    <field-descriptor id = "1"
  name = "shipmentOidPiece"
  column = "SHIPMENT_OID"
  jdbc-type ="INTEGER"
  primarykey = "true"
    />
    <field-descriptor id = "2"
  name = "typeFlg"
  column = "TYPE_FLG"
  jdbc-type ="VARCHAR"
  primarykey = "true"
    />

    <reference-descriptor
  name="piece"
  class-ref="com.data.A"
  proxy="true">
  <foreignkey field-id-ref="1"/>
  <foreignkey field-id-ref="2"/>
    </reference-descriptor>
</class-descriptor>


[DEFAULT] WARN: OJB broker could not materialize
com.fedex.data.CorePieceCounterImpl{188119,JP}
[org.apache.ojb.broker.accesslayer.IndirectionHandler] ERROR: Method
invoking failed for method *getSubmitFlag* on object null
null
java.lang.NullPointerException
        at
org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(Unknown Source)
        at $Proxy1.getSubmitFlag(Unknown Source)
        at TestClient.testEqualCriteriaOneToOne(TestClient.java:104)
        at TestClient.runApp(TestClient.java:78)
        at TestClient.main(TestClient.java:71)
Exception in thread "main" java.lang.NullPointerException
        at
org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(Unknown Source)
        at $Proxy1.getSubmitFlag(Unknown Source)
        at TestClient.testEqualCriteriaOneToOne(TestClient.java:104)
        at TestClient.runApp(TestClient.java:78)
        at TestClient.main(TestClient.java:71)
rethrown as org.apache.ojb.broker.PersistenceBrokerException: Error
invoking:getSubmitFlag
        at
org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(Unknown Source)
        at $Proxy1.getSubmitFlag(Unknown Source)
        at TestClient.testEqualCriteriaOneToOne(TestClient.java:104)
        at TestClient.runApp(TestClient.java:78)
        at TestClient.main(TestClient.java:71)
Caused by: java.lang.NullPointerException
        ... 5 more


Any help on this is appreciated. Thanks


regards.

Janet

----- Original Message -----
From: "Jakob Braeuchi" <[EMAIL PROTECTED]>
To: "OJB Developers List" <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 01:15
Subject: Re: ArrayIndexOutOfBoundsException when using composite primary
keys


> hi janet,
>
> imo this problem is coming from a reference-descriptor  not matching the
> number of pk fields in the referenced object:
>
>    <class-descriptor
>       class="brj.ojb.Person"
>       table="tabPerson"
>    >
>       <field-descriptor id="1"
>          name="id"
>          column="id"
>          jdbc-type="INTEGER"
>          primarykey="true"               <<<< pk1
>          autoincrement="true"
>          conversion="brj.ojb.TestFieldConversion"
>       />
>       <field-descriptor id="2"
>          name="vorname"
>          column="vorname"
>          jdbc-type="VARCHAR"
>       />
>       <field-descriptor id="3"
>          name="name"
>          column="name"
>          jdbc-type="VARCHAR"
>          primarykey="true"            <<<< pk2
>       />
> ...
>       <reference-descriptor
>          name="partner"
>          class-ref="brj.ojb.Person"
>          proxy="true"
>          >
>          <foreignkey field-ref="idPartner"/>   <<<< one fk ('name') is
> missing
>       </reference-descriptor>
>
> hth
> jakob
>
>
> Janet Song wrote:
>
> >Hi,
> >
> >When i map compound or composite primary keys, i get an
> >ArrayOutOfBoundsException. Single primary key is fine. Appreciate it if
> >someone could shed some light on this problem. Thanks!
> >
> >
> >[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR:
> >PersistenceBrokerException during the execution of materializeObject:
Could
> >not generate primary key values for given Identity
> >com.fedex.data.CorePieceCounterImpl{188119}, exception was
> >java.lang.ArrayIndexOutOfBoundsException: 1: 1
> >Could not generate primary key values for given Identity
> >com.fedex.data.CorePieceCounterImpl{188119}, exception was
> >java.lang.ArrayIndexOutOfBoundsException: 1: 1
> >java.lang.ArrayIndexOutOfBoundsException: 1
> >        at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(Unknown
> >Source)
> >        at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(Unknown
> >Source)
> >        at
> >org.apache.ojb.broker.accesslayer.StatementManager.getKeyValues(Unknown
> >Source)
> >        at
> >org.apache.ojb.broker.accesslayer.StatementManager.bindSelect(Unknown
> >Source)
> >        at
>
>org.apache.ojb.broker.accesslayer.JdbcAccessImpl.materializeObject(Unknown
> >Source)
> >        at
> >org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Unknown
> >Source)
> >        at
>
>org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByIdentity(Un
k
> >nown Source)
> >        at
>
>org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getObjectByIdent
i
> >ty(Unknown Source)
> >        at
>
>org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unk
n
> >own Source)
> >        at
>
>org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
> >Source)
> >        at
> >org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(Unknown
Source)
> >        at $Proxy1.getSubmitFlag(Unknown Source)
> >        at TestClient.testEqualCriteriaOneToOne(TestClient.java:104)
> >
> >
> >regards,
> >
> >Janet
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to