weird problems with context

From: Marcin Skladaniec (marci..sh.com.au)
Date: Fri Jun 01 2007 - 21:43:19 EDT

  • Next message: Lachlan Deck: "Re: weird problems with context"

    Hi
    I'm having a strange problem. When executing this bit of code:

    List categories = aContext.performQuery(new SelectQuery
    (Category.class));
    if (categories.size() != 0) {
            for (int categoriesCount = 0; categoriesCount < categories.size();
    categoriesCount++) {
                     Category cat = (Category) categories.get(categoriesCount);
                    logger.debug("context equal ? " + cat.getObjectContext().equals
    (aContext));
            }
    }
                                                            
    the contexts are not equal, and I cant find the reason why !

    I found this problem, because the perPersist() callback is not fired
    when I do
    cat.getObjectContext().newObject(SomeEntity.class)
    but it is when
    aContext.newObject(SomeEntity.class)
    to add complexity, postPersist() and other callbacks are fired in
    both cases.

    Any clues ?

    Marcin



    This archive was generated by hypermail 2.0.0 : Fri Jun 01 2007 - 21:43:51 EDT