Re: [OJB-developers] problem with path expressions and extents
Brought to you by:
thma
From: Thomas M. <tho...@ho...> - 2002-05-26 08:40:38
|
Hi Jakob, Jakob Braeuchi wrote: > hi thomas, > > unfortunately it's not related to buggy extent definition, it's a general > problem !!! > :-( > when the SqlStatement resolves the path expressions ie: > 'allArticlesInGroup.id' then it looks up the collection descriptor for > 'allArticlesInGroup' in the class definition of productgroup. > this collection descriptor references the base class only ( Article ), so > SqlStatement will use the table of the base class for the query and thus > will not find a productgroup for the CdArticle with id 200. > Oh, now I got it! That's really a problem. > i implemented a kind of hint for SqlStatement: > QueryByCriteria#addPathClass(aPathSegment, aClass) > > ie: addPathClass("allArticlesInGroup", CdArticle.class), so SqlStatement > will use the table for CdArticle when building the sql. > OK! > this stuff is now in cvs, and there's also a testcase for it: > QueryTest#testInversePathExpression(). > so far it's used only for querying inverse m:n relationships in > PersistenceBrokerImpl##getMtoNQuery(). > > an other cleaner solution would be the use of sql UNION whenever dealing > with extents, but mysql currently does not support them. > Yes UNION statements are not supported on some platforms and on other platforms they are quite slow. So I think using a hin for this kind of lookups is OK. cheers, Thomas |