• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERRest Update Op Fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERRest Update Op Fails


  • Subject: Re: ERRest Update Op Fails
  • From: Farrukh Ijaz <email@hidden>
  • Date: Mon, 6 Dec 2010 21:10:07 +0300

On 2010-12-06, at 8:58 PM, Benjamin Miller wrote:

> I'm using ERRest to provide access to a number of entities in my app. Updating values in one entity fails silently and I can't figure out where to look. I suspect this may not be related to ERRest but when I'm using the same model and classes in other 'more traditional' (for me) areas of my app, there are no problems. Other entities using the same method update fine and the other CRUD actions behave normally.
>
> I perform an update request:
>
> PUT /cgi-bin/WebObjects/Patrol.woa/ra/suite_runs/10 HTTP/1.1
>
> <SuiteRuns>
>  <priority>11</priority>
> </SuiteRuns>
>
>
> I'm using modified example code to handle the request:
>
> public WOActionResults updateAction() {
> 		SuiteRun suiteRun = routeObjectForKey("suiteRun");
> 		update(suiteRun, listFilter());

It looks like you're using a wrong filter for update. I think you should use something like following:

update(suiteRun, ERXKeyFilter.filterWithAttributes());

What I suspect is the listFilter() is used to return fewer attributes in the response. This omits the mandatory. When you want to update, you have to use the the filter which does not omit any of the mandatory values. E.g.

Farrukh


> 		editingContext().saveChanges();
> 		return response(suiteRun, showFilter());
> 	}
>
> 	public ERXKeyFilter updateFilter() {
> 		ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
> 		filter.include(SuiteRun.TESTS);
> 		filter.include(SuiteRun.TEST_INVOCATIONS);
> 		return filter;
> 	}
>
> The object to update looks OK, so does the EC used. update() appears to work and the new values are pushed into the EO. The EO isn't persisted to the database and the EC doesn't register any changes. As the EO is populated with the new values, a correct response is returned to the client. The save fail is silent and nothing appears in logs.
>
> Any ideas where to start looking?
>
> Thanks,
> Benjamin
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >ERRest Update Op Fails (From: Benjamin Miller <email@hidden>)

  • Prev by Date: ERRest Update Op Fails
  • Next by Date: Re: x-webobjects-request-id lacking uniqueness?
  • Previous by thread: ERRest Update Op Fails
  • Next by thread: D2W automatically assign a value to an attribute
  • Index(es):
    • Date
    • Thread