Hi!

Using saveChanges() and defaultEditingContext() in the same code line is a really bad idea. The defaultEditingContext should only be used to store long-living read-only objects.

To make changes, you should use local ECs. If you are modifying and writing objects with the default EC, you'll quickly loose control on what is on the default EC, and nothing will work at all. An EC is like a sandbox, a very intelligent and powerful transaction (I'll be beaten for using the T word, I know). So you should keep its changes as local as possible. "It's a local EC for local EOs".

  Yours

Miguel Arroz

On 2008/01/10, at 01:07, Peter Thompson wrote:

Hello,

We have an intermittent behaviour as follows:
We have an object (build via EOModeler) fetched into the session's default editing context; which we are able to update successfully via WO component bindings / java code via session ().defaultEditingContext().saveChanges(). We then do a session ().defaultEditingContext().refreshAllObjects(), but a subsequent change to the object (via a "setter" in java code) is only sometimes updated by a subsequent session().defaultEditingContext ().saveChanges(). This behaviour appears totally random - on debugging we notice that sometimes the EditingContext's "updatedObjects()" reflects the update done by the setter, and sometimes it does not.
Is this a known problem?

Are we making assumptions that we shouldn't be i.e. is it correct to assume that if we do...
1. fetch object into session's default editing context.
2. do updates on object via components / java code.
3. save object via:
session().defaultEditingContext().saveChanges();
session().defaultEditingContext().refreshAllObjects();
4. do further updates on object via java code.
5. save object again via:
session().defaultEditingContext().saveChanges();
session().defaultEditingContext().refreshAllObjects();
That step 5 should save the changes?

Appreciate any assistance you can give.

Cheers,
Peter

Peter Thompson
Senior Developer/Architect
Run The Red
www.runthered.com
===================================
E:  [EMAIL PROTECTED]
M:  + 64 21 241 3266  /  + 64 27 441 3255
DDI:  + 64 4 801 2806
P: +64 4 384 6880  F: +64 4 384 6875
Skype: peterwgtnnz
PO Box 11-703,
Level 2 Tadix House, 1 Blair Street,
Te Aro, Wellington 6011, New Zealand
===================================

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/arroz% 40guiamac.com

This email sent to [EMAIL PROTECTED]

Miguel Arroz
http://www.terminalapp.net
http://www.ipragma.com



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to