Re: weird problems with context

From: Marcin Skladaniec (marci..sh.com.au)
Date: Tue Jun 05 2007 - 01:38:12 EDT

  • Next message: Andrus Adamchik: "Re: weird problems with context"

    Hi,

    I would like to clarify, that the context are not equal, and it does
    not matter if I choose to compare them by "equal()" or "==".

    I cant still get to the bottom of it, how it is possible, that if
    both listeners (prePersist and postPersist) are registered together,
    only one of them is fired when using
    anObject.getObjectContext().newObject().

    Marcin

    On 02/06/2007, at 11:43 AM, Marcin Skladaniec wrote:

    > 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 : Tue Jun 05 2007 - 01:38:39 EDT