Re: 3.0M4 : Fetching from relationship returns TRANSIENT objects.

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Sep 15 2008 - 05:43:50 EDT

  • Next message: Andrus Adamchik: "Re: Returning updated rows from SQLTemplate"

    Hi,

    Sorry, you posted this earlier and looks like nobody replied yet.

    > So my question is : is this normal to get TRANSIENT objects from a
    > relationship after a rollback ?

    No, it is not normal. I just created a test case to reproduce it and
    things seem to be working ok:

         PaintingInfo info = ctxt.newObject(PaintingInfo.class);
         info.setTextReview("XXX");
         p1.setToPaintingInfo(info);

         assertSame(info, p1.getToPaintingInfo());
         ctxt.rollbackChanges();
         assertNull(p1.getToPaintingInfo());

    Does it look like the scenario that you have, or am I missing something?

    Thanks,
    Andrus

    On Sep 15, 2008, at 12:22 PM, Laurent Marchal wrote:

    > Hello again !
    >
    > I have a strange thing happening in Cayenne 3.0M4 :
    > I have two tables ARTIST and ARTIST_AUX where extended artist's
    > properties are stored.
    >
    > There is a relationship between ARTIST--->ARTIST_AUX where i checked
    > "To
    > Dep PK" since no ARTIST_AUX rows can exists without corresponding
    > ARTIST.
    >
    > I have also a addPrefetch(ARTIST_AUX) when i retrieve ARTISTs.
    >
    > In my "artist editor" I create ARTIST_AUX rows at need and when an
    > error
    > occurs i do a rollback().
    > The strange thing is that when i refetch ARTISTS_AUX with the
    > relationship, instead of getting only existing ARTISTS_AUX, i get also
    > the ARTISTS_AUX created before the rollback() with the TRANSIENT state
    > and no ObjectContext associated.
    >
    > So my question is : is this normal to get TRANSIENT objects from a
    > relationship after a rollback ?
    >
    > Thanks
    > Laurent Marchal.
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Sep 15 2008 - 05:44:24 EDT