You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Vladimir Kirichenko <ra...@male.ru> on 2004/11/25 11:39:52 UTC

org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher bug

org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher bug

in method

     private Criteria buildPrefetchCriteria(Collection ids, 
String[] fkCols, String[] itemFkCols,
             FieldDescriptor[] itemPkFields)
     {
         if (fkCols.length == 1) //bug is here
         {
             return buildPrefetchCriteriaSingleKey(ids, 
fkCols[0], itemFkCols[0], itemPkFields[0]); //only first 
item's foreign key passed
         }
         else
         {
             return buildPrefetchCriteriaMultipleKeys(ids, 
fkCols, itemFkCols, itemPkFields);
         }

     }

assumption that if parent table has the only foreign key then 
item table has the only FK too is incorrect.

<collection-descriptor name="recipients" 
element-class-ref="nVerge.commons.User"
auto-delete="link" auto-retrieve="true" auto-update="link"
indirection-table="hot_folder_recipients">
  <fk-pointing-to-this-class column="hot_folder_id"/>
  <fk-pointing-to-element-class column="user_login"/>
  <fk-pointing-to-element-class column="user_network_id"/> 
<!-- this FK is not put into where criteria -->
</collection-descriptor>

Quickfix for this is  if (fkCols.length == 1 && 
itemFkCols.length == 1)


--
Best Regards,
Vladimir Kirichenko

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher bug

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi vladimir,

this bug is also present on the current ojb 1.1
i'll apply your patch asap.

thanks
jakob

Jakob Braeuchi schrieb:
> hi vladimir,
> 
> which version of ojb are you using ?
> 
> jakob
> 
> 
>>org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher bug
>>
>>in method
>>
>>     private Criteria buildPrefetchCriteria(Collection ids, 
>>String[] fkCols, String[] itemFkCols,
>>             FieldDescriptor[] itemPkFields)
>>     {
>>         if (fkCols.length == 1) //bug is here
>>         {
>>             return buildPrefetchCriteriaSingleKey(ids, 
>>fkCols[0], itemFkCols[0], itemPkFields[0]); //only first 
>>item's foreign key passed
>>         }
>>         else
>>         {
>>             return buildPrefetchCriteriaMultipleKeys(ids, 
>>fkCols, itemFkCols, itemPkFields);
>>         }
>>
>>     }
>>
>>assumption that if parent table has the only foreign key then 
>>item table has the only FK too is incorrect.
>>
>><collection-descriptor name="recipients" 
>>element-class-ref="nVerge.commons.User"
>>auto-delete="link" auto-retrieve="true" auto-update="link"
>>indirection-table="hot_folder_recipients">
>>  <fk-pointing-to-this-class column="hot_folder_id"/>
>>  <fk-pointing-to-element-class column="user_login"/>
>>  <fk-pointing-to-element-class column="user_network_id"/> 
>><!-- this FK is not put into where criteria -->
>></collection-descriptor>
>>
>>Quickfix for this is  if (fkCols.length == 1 && 
>>itemFkCols.length == 1)
>>
>>
>>--
>>Best Regards,
>>Vladimir Kirichenko
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher bug

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi vladimir,

which version of ojb are you using ?

jakob

> 
> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher bug
> 
> in method
> 
>      private Criteria buildPrefetchCriteria(Collection ids, 
> String[] fkCols, String[] itemFkCols,
>              FieldDescriptor[] itemPkFields)
>      {
>          if (fkCols.length == 1) //bug is here
>          {
>              return buildPrefetchCriteriaSingleKey(ids, 
> fkCols[0], itemFkCols[0], itemPkFields[0]); //only first 
> item's foreign key passed
>          }
>          else
>          {
>              return buildPrefetchCriteriaMultipleKeys(ids, 
> fkCols, itemFkCols, itemPkFields);
>          }
> 
>      }
> 
> assumption that if parent table has the only foreign key then 
> item table has the only FK too is incorrect.
> 
> <collection-descriptor name="recipients" 
> element-class-ref="nVerge.commons.User"
> auto-delete="link" auto-retrieve="true" auto-update="link"
> indirection-table="hot_folder_recipients">
>   <fk-pointing-to-this-class column="hot_folder_id"/>
>   <fk-pointing-to-element-class column="user_login"/>
>   <fk-pointing-to-element-class column="user_network_id"/> 
> <!-- this FK is not put into where criteria -->
> </collection-descriptor>
> 
> Quickfix for this is  if (fkCols.length == 1 && 
> itemFkCols.length == 1)
> 
> 
> --
> Best Regards,
> Vladimir Kirichenko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 

-- 
NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
GMX DSL-Netzanschluss + Tarif zum superg�nstigen Komplett-Preis!

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org