More SharedEC woes: relationships into SEC not saved?!?
More SharedEC woes: relationships into SEC not saved?!?
- Subject: More SharedEC woes: relationships into SEC not saved?!?
- From: OCsite via Webobjects-dev <email@hidden>
- Date: Sat, 11 Jan 2020 03:28:49 +0100
Hi there,
this is weird. My EOs have some relationships into the SharedEC — of course,
one-way without an inverse; I understand that relationships to SEC are all
right, only those from it outside are forbidden. (Am I wrong perhaps? If those
relationships were set up in the database without SEC, it works perfectly.)
Nevertheless, when I run with SEC, whatever I try, it seems these relationships
are — silently and without reporting any problem — not saved.
Say, I have an EO foo of entity Foo with two simple :1 relationships: a (based
on FK a_id) into a normal-EC entity, and b (based on FK b_id) into a shared-EC
entity. Both are modelled the same way (simple join from the FK in the source
entity to the PK of the target entity). I set both of them, like this:
===
ERXEC ec=....
Foo foo=new Foo()
ec.insertObject(foo)
assert ec==someObject.editingContext()
foo.a=someObject
assert ec.sharedEditingContext()==someSharedObject.editingContext()
foo.b=someSharedObject
assert foo.b==someSharedObject
ec.saveChanges()
===
Now, changes are saved, no error is reported, new object is properly inserted
into the database
- its a_id is filled by someObject's PK
- whilst its b_id is filled by NSKeyValueCoding$Null!
Same happens when editing: the relationships to SEC when changed never seem to
save the appropriate FK value. It seems completely ignored by the saving
process:
===
assert
foo.editingContext().sharedEditingContext()==anotherSharedObject.editingContext()
foo.b=anotherSharedObject
assert foo.b==anotherSharedObject
assert foo.committedSnapshotValueForKey('b')==NSKeyValueCoding$Null
assert foo.changesFromCommittedSnapshot==[b: anotherSharedObject]
foo.editingContext().saveChanges()
assert foo.b==null
===
other changes of foo (if any) are saved all right, but its b_id never changes.
No error is reported.
Does this make any sense, is it perhaps an expected behaviour? As always, I
might be overlooking something of importance, but this feels completely wrong
to me. Could it be caused by some bug at my side? If so, any idea where and how
to hunt for it?
Thanks a lot for any insight,
OC
_______________________________________________
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