Problem traversing relationships - need hint

From: Arturo Perez (apere..ayesinc.com)
Date: Mon Jun 19 2006 - 09:13:15 EDT

  • Next message: Andrus Adamchik: "Re: Problem traversing relationships - need hint"

    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



    This archive was generated by hypermail 2.0.0 : Mon Jun 19 2006 - 09:14:08 EDT