Hi Samuel,

Had similar problem and the answer was that I was trying to map more columns in 
indirection table then existed in a class I was referring to, like

f.e. I had :

Class1(PK1)
Class2(PK2,PK3)

and

IndirectionTable1(PK1,PK2,PK3)

The the wrong thing I did was:

Class1.Relation1(using IndirectionTable1)({PK1},{PK1,PK2,PK3}) - WRONG! - 
resulting in ArrayIndexOutOfBoundsException. As there are just two keys in 
Class2 not three!!!

Class1.Relation1(using IndirectionTable1)({PK1},{PK2,PK3}) - CORRECT!

Hope it helps,

-Sergey




-----Original Message-----
From: Gru Samuel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 14, 2005 3:11 AM
To: 'OJB Users List'
Subject: RE: ArrayIndexOutOfBoundsException Exception

Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-----Message d'origine-----
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception


Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :
<class-descriptor class="fr.ouestfrance.xxx.ProcedureServeur" table="proc">
        ....
        <collection-descriptor
                name="_Fonctions"

element-class-ref="fr.ouestfrance.xxx.FonctionParametreServeur"
                auto-retrieve="true"
                auto-update="true"
                auto-delete="true"
                orderby="nb_ordre" sort="ASC"
indirection-table="procedurefonction"
          >
                <fk-pointing-to-this-class column="id_proc"/>
                <fk-pointing-to-element-class
column="id_fonctionparametree"/>
        </collection-descriptor>
 </class-descriptor>

<class-descriptor
        class="fr.ouestfrance.xxx.FonctionParametreServeur"
        table="fonctionparametree">
        <field-descriptor name="_Id" column="id_fonctionparametree"
jdbc-type="numeric" primarykey="true" autoincrement="true" access="readonly"
/>
        ....
        <collection-descriptor  name="_Parametres"
element-class-ref="ParametreValoriseServeur"
                auto-update="true"
                auto-delete="true"
                auto-retrieve="true"
                orderby="nb_ordre" sort="ASC"
               indirection-table="fonctionparametrevalorise">
         <fk-pointing-to-this-class column="id_fonctionparametree"/>
         <fk-pointing-to-element-class column="id_parametrevalorise"/>
        </collection-descriptor>
        <reference-descriptor     name="_FonctionInstanciee"
class-ref="fr.ouestfrance.xxx.FonctionServeur"
                auto-retrieve="true"
                auto-update="false"
              auto-delete="false">
              <foreignkey field-ref="_FonctionInstanciee::_Id" />
        </reference-descriptor>
</class-descriptor>
<class-descriptor
        class="fr.ouestfrance.xxx.ParametreValoriseServeur"
        table="parametrevalorise">
        <field-descriptor name="_Id" column="id_parametrevalorise"
                             jdbc-type="numeric" primarykey="true"
autoincrement="true" access="readonly"/>
...
</class-descriptor>

java.lang.ArrayIndexOutOfBoundsException: 2
        at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
        at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
        at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
....

Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :
>       String[] indFkCols = getFksToThisClass();
>        String[] indItemFkCols = getFksToItemClass();
>        FieldDescriptor[] pkFields =
getOwnerClassDescriptor().getPkFields();
>        FieldDescriptor[] itemPkFields =
getItemClassDescriptor().getPkFields();
>        String[] cols = new String[indFkCols.length +
indItemFkCols.length];
>        int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];
Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel
----------------------------------------------------------------------------
--------------
Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.
----------------------------------------------------------------------------
--------------

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

----------------------------------------------------------------------------
--------------
Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.
----------------------------------------------------------------------------
--------------

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


**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.

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

Reply via email to