You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Gru Samuel <Sa...@ouest-france.fr> on 2005/09/14 09:11:04 UTC
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:Samuel.Gru@ouest-france.fr]
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
----------------------------------------------------------------------------
--------------
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: ArrayIndexOutOfBoundsException Exception
Posted by Armin Waibel <ar...@apache.org>.
Hi Samuel,
maybe there is an issue with your mapping metadata (you don't post the
whole metadata related to your m:n relations, so I can't review it).
If you use a composed primary key (by specifying more than one PK field)
in class-descriptor, the indirection table has to reflect the composed
PK(if the "left" class has 3 PK fields, "right" class has 2 PK fields,
the indirection table has to reflect all PK's in 3+2 columns).
An example using composed PK with m:n relation can be found in OJB
test-suite, the mapping can be found in repository_reference.xml
class-descriptor for org.apache.ojb.broker.M2NTest$MovieImpl
http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/repository_junit_reference.xml?rev=1.17.2.5&view=markup
Could this be the issue?
regards,
Armin
Gru Samuel wrote:
> 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:Samuel.Gru@ouest-france.fr]
> 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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
> ----------------------------------------------------------------------------
> --------------
> 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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org