if the class CategoriesDescription has 2 pks then those 2 pks must be present in the indirectiontable as it always must contain the sum of the pks of the connected classes. either you add the languageId to fk-pointing-to-element-class or you languageId must not be defined as pk.
hth jakob
Claudio Romano wrote:
Hi All,
i just updated to OJB_BRANCH_1_0. Now i have some Problems
with M:N mappings. (The categories_description has two primarkeys!!)
I always get an exception when i try to get the CategoriesDesctiption from the Product.
======================== My Class-Descriptors: ========================
<class-descriptor class="Products" table="products">
<field-descriptor id="1" name="id" column="products_id" jdbc-type="INTEGER" autoincrement="true" primarykey="true" nullable="false" length="11"/>
<collection-descriptor element-class-ref="CategoriesDescription" name="categoriesDesc" indirection-table="products_to_categories" auto-delete="false" auto-update="false" auto-retrieve="true" refresh="true" proxy="true">
<fk-pointing-to-this-class column="products_id"/>
<fk-pointing-to-element-class column="categories_id"/>
</collection-descriptor>
</class-descriptor>
<class-descriptor class="CategoriesDescription" table="categories_description">
<field-descriptor id="1" name="categoriesId" column="categories_id" primarykey="true"
jdbc-type="INTEGER" nullable="false" length="11"/>
<field-descriptor id="2" name="languageId" column="language_id"
primarykey="true" jdbc-type="INTEGER" nullable="false" length="11"/>
</class-descriptor>
<class-descriptor class="ProductsToCategories" table="products_to_categories">
<field-descriptor id="1" name="productsId" column="products_id" jdbc-type="INTEGER" primarykey="true"
nullable="false" length="11" indexed="true"/>
<field-descriptor id="2" name="categoriesId" column="categories_id" jdbc-type="INTEGER" primarykey="true" nullable="false" length="11" indexed="true"/>
</class-descriptor>
======================== The Exception ======================== java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatc hed(MtoNCollectionPrefetcher.java:392) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelat ionship(MtoNCollectionPrefetcher.java:126) at org.apache.ojb.broker.core.QueryReferenceBroker$PBPrefetchingListener.pr efetch(QueryReferenceBroker.java:837) at org.apache.ojb.broker.core.QueryReferenceBroker$PBCollectionProxyListene r.beforeLoading(QueryReferenceBroker.java:894) at org.apache.ojb.broker.accesslayer.CollectionProxy.beforeLoading(Collecti onProxy.java:173) at org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProx y.java:400) at org.apache.ojb.broker.accesslayer.CollectionProxy.iterator(CollectionPro xy.java:230) at Products.getCategoriesName(Products.java:198)
I something wrong with my mapping?
thanks in advance Claudio Romano
www.lindos.ch yourshopadmin.sourceforge.net
--------------------------------------------------------------------- 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]