Re: Delay with EO deletion?
Re: Delay with EO deletion?
- Subject: Re: Delay with EO deletion?
- From: Pascal Robert <email@hidden>
- Date: Wed, 08 Feb 2012 10:04:30 -0500
Le 2012-02-07 à 20:23, Chuck Hill a écrit :
> Hi Pascal,
>
> On 2012-02-07, at 12:39 PM, Pascal Robert wrote:
>
>> Hi guys,
>>
>> I have a problem with an editing context, look like it's a delay when I delete objects (objects that are not yet in the database). So in short, people create transactions (not database transactions) when they add items to a job (just like when you add stuff in a shopping cart) and can decide to remove a transaction from the job. When they remove an item from the job, I do:
>>
>> rootTransaction.deleteSubTransactionsRelationship(transactionItem);
>
> Does this do the same thing as removeObjectFromBothSides… ?
Yes, it's the delete method coming from the Wonder templates:
public void deleteSubTransactionsRelationship(com.obzerv.eo.Transaction object) {
removeObjectFromBothSidesOfRelationshipWithKey(object, "subTransactions");
editingContext().deleteObject(object);
}
>
>> editingContext().deleteObject(transactionItem);
>
> That does very little until editingContext().processRecentChanges() is called.
>
>
>> But when the page reload (by a Ajax call), the list of available items is not updated. Example:
>>
>> - I have Item 1 and Item 2 available to put in the job
>>
>> - I add Item 1 to the job, it's not available to pick up, that's what I want
>> - I add Item 2 to the job, it's not available to pick up, that's what I want
>>
>> - I remove Item 1 from the job, so that's calling the deleteObject() and deleteSubTransactionsRelationship() methods. Item 1 disappears from the job (ok), but it's not available for picking up (bad).
>>
>> - I remove Item 2 from the job, and now Item 1 is available for pickup! But Item 2 is still not available, until I do a revert on the editing context and redo the steps.
>
> Sounds like a processRecentChanges() problem, or your code is not adding it back to the available list right away?
>
>
>> If I print editingContext().deletedObjects() after the call to editingContext().deleteObject(transactionItem), I see that the item (Item 2) I'm removing is in the array. If I print it again when I delete I ten 2, the only object in editingContext().deletedObjects() is Item 2, Item 1 is not in it anymore.
>>
>> So the question: is there some kind of delay when you delete an object in the EC and just after you use a relationship (the relationship is for finding the available items)?
>
> deleteObject() does not do much other than record that the object is to be deleted. Also, could you be calling saveChanges() at some point?
>
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
_______________________________________________
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