my first attempt was much to simple :( i didn't consider the intermediate table wich causes some problems in query definition.
another idea was to use the inverse relationship, but i think we cannot assume that this relationship is always defined.
jakob
Jakob Braeuchi wrote:
hi andy,
please try adding the following method to CollectionDescriptor
public FieldDescriptor[] getForeignKeyFieldDescriptors(ClassDescriptor aCld)
{
if (isMtoNRelation())
{
// BRJ: answer pkFields of referenced Class
return aCld.getPkFields();
}
else
{
return super.getForeignKeyFieldDescriptors(aCld);
}
}
jakob
Andy Malakov wrote:
As far as I can see from CVS, CollectionPrefetcher.buildPrefetchQuery(...) only checks among 1:N references:
protected Query buildPrefetchQuery(Collection ids)
{
CollectionDescriptor cds = getCollectionDescriptor();
QueryByCriteria query = buildPrefetchQuery(ids, cds.getForeignKeyFieldDescriptors(getItemClassDescriptor()));
...
where cds.getForeignKeyFieldDescriptors(getItemClassDescriptor()) will return empty array because class CollectionDescriptor does
not override method getForeignKeyFieldDescriptors() implemented in base class ObjectReferenceDescriptor (which only knows about
'decomposed' FKs).
All the Best, Andy
----- Original Message ----- From: "Andy Malakov" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, December 02, 2003 12:06 PM
Subject: Query prefetching non-decomposed M:N relationships is unimplemented?
Hello All,
Can you please confirm that association prefetching mechanism in OJB queries currently (CVS) does not support M:N associations?
Thank you, Andy
--------------------------------------------------------------------- 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]
