Hi Andrew,
I think you shouldn't return a filtered response when you're deleting the
object. Your response should indicate your operation was successful or not
based on the editingContext().saveChanges() out come.
response(entity, showFilter()) should be used for GET (fetch / select) and
optionally in PUT (insert) and POST (update).
Farrukh
On 2011-03-28, at 10:36 PM, Andrew Kinnie wrote:
> I am again working on my ERRest based push notification server, and am having
> an issue with the framework.
>
> I am using a version of Wonder from last week (the 5.4 branch), in eclipse
> 3.6 using a MySQL database on the development machine.
>
> I looked at the example app, and copied the key functions from it (after
> wasting time trying to over-think it for a while going back to the easy
> method).
>
> I can add a new object, it stores it in the database, but if I then attempt
> to delete it using the code:
>
> @Override
> public WOActionResults destroyAction() throws Throwable {
> NotificationType type = notificationType();
> type.delete();
> editingContext().saveChanges();
> return response(type, showFilter());
> }
>
> The "type" gets the delete message, saveChanges deletes the row in the
> database (the EO_PK_TABLE still shows it's pk as the current pk, which I
> gather is normal) but then the returned method
>
> response(type, showFilter());
>
> crashes with an NPE deep in the guts of ERRest:
>
> requestNode._fillInWithObjectAndFilter(obj, classDescription,
> keyFilter, delegate, new HashSet<Object>());
>
> This is called in ERXRestRequestNode.java. It appears (though I'm not
> completely sure) that the method is asking for the old object it just
> deleted, and there isn't one, because it just deleted it. However, I copied
> this code directly from the example, so something somewhere is going wrong
> that doesn't go wrong in the example app.
>
> So, I can avoid all this by just returning null, as the user will not
> actually need to get a response, but I thought I'd ask the question, what
> should I be doing here, and what might be going wrong?
>
> Andrew
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]