cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arturo Perez <ape...@hayesinc.com>
Subject Problem traversing relationships - need hint
Date Mon, 19 Jun 2006 13:13:15 GMT
Hi all,

I had this problem with the last beta and was hoping RC1 would fix but
no such luck.

I have 4 entities, Article, ArticleMeta, ArticleCategory and
ArticleCategoryLink.  ArticleCategoryLink is just a join table 
between ArticleMeta and ArticleCategory.  (I don't do flattened 
relationships yet).  ArticleMeta has a FK/relationship
to Article.

If I do this

Iterator i = articleCategory.getArticles().iterator();
while (i.hasNext()) {
      ArticleCategoryLink acl = (ArticleCategoryLink)i.next();
      ArticleMeta am = acl.getLatestArticle();
      Article a = am.getArticle();
}

The article is null but if I run an Expression I get what I expect:

Expression exp = 
   ExpressionFactory.matchExp("activeArticle.categories.category",
        category);
exp = exp.andExp(
    Expression.fromString("latestArticle.article  activeArticle.article"));
DataContext dbContext = ArticleManager.getArticleManager().getDataContext();
SelectQuery catQuery = new SelectQuery(Article.class, exp);

Any suggestions on where to look for improperly defined model etc?

tia,
arturo



Mime
View raw message