Re: RefreshQuery not supports insert/delete?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 25 2008 - 09:48:27 EDT

  • Next message: Andrey Razumovsky: "Re: RefreshQuery not supports insert/delete?"

    Fixed. The fix is very similar to Andrey's, only applied inside Cayenne.

    Andrus

    On Jun 25, 2008, at 4:26 PM, Andrus Adamchik wrote:

    > This is a bug. Let me see if there is a quick fix.
    >
    > https://issues.apache.org/cayenne/browse/CAY-1082
    >
    > Andrus
    >
    >
    > On Jun 24, 2008, at 1:37 PM, Andrey Razumovsky wrote:
    >
    >> Hi!
    >>
    >>
    >> I can't figure out how to make the refreshing query work with
    >> inserting or
    >> deleting rows in database. For instance:
    >>
    >>
    >> Artist a = ...
    >>
    >> assert a.getPaintingsArray().size() == 0;
    >>
    >>
    >> //here is direct insert into database a painting of artist a
    >> (artistid=a.id
    >> )
    >>
    >>
    >> RefreshQuery refresher = new RefreshQuery();
    >>
    >> context.performGenericQuery(refresher);
    >>
    >>
    >> assert a.getPaintingsArray().size() == 1; //that's false
    >>
    >>
    >>
    >> Everything works perfect when I sql-update in database. When i sql-
    >> delete,
    >> i do also get an exception like this:
    >>
    >> org.apache.cayenne.FaultFailureException: [v.3.0M4 May 18 2008
    >> 16:32:02]
    >> Error resolving fault, no matching row exists in the database for
    >> ObjectId:
    >> <ObjectId:Apkforecast, apkforecastid=3>
    >>
    >> at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:
    >> 100)
    >>
    >> at com.nic.rainbow.data.auto._Apkforecast.getDate(_Apkforecast.java:
    >> 29)
    >>
    >> ...and so on
    >>
    >> when i try to iterate through related array
    >>
    >>
    >> I'm using ROP if that helps. By the way, when i restart client, the
    >> data
    >> becomes correct, so i assume everything has changed correctly on a
    >> server.
    >>
    >> If that's not supported, can you give me some advice to manually
    >> refresh the
    >> desired relationships?
    >>
    >>
    >> Thanks,
    >>
    >> Andrey
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 25 2008 - 09:49:02 EDT