• 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: Problem saving Many-to-Many relationship changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem saving Many-to-Many relationship changes


  • Subject: Re: Problem saving Many-to-Many relationship changes
  • From: Merul Patel <email@hidden>
  • Date: Wed, 22 Oct 2003 16:46:06 +0100

I've been very good indeed;-)

I double-checked my code for the custom classes and the model by using D2W and found I could do what I needed, so then went back to the bookshelf and saw from WOWACK that to handle the flattened relationship correctly I need to modify the generated method in the custom class for object A to properly set the many-to-many relationship, eg: by modifying the method in A like

public void SetBs(NSMutableArray value) {
int index;
willChange();
for (index=0; index<this.Bs().count();index++) {
EOGenericRecord B = (EOGenericRecord) this.Bs().objectAtIndex(index);
this.removeObjectFromBothSidesOfRelationshipWithKey(B,"AB");
}
... and then another for-loop to add the elements of the VALUE array on both sides of the same relationship, remembering to also override the inverseForRelationshipKey() method as well to cope with the flattened relationship.


There's still a bug I need to work on to fix the problem completely, but this does address the basic problem in that I can at least edit the many-to-many relationship.

Merul

On Wednesday, October 22, 2003, at 03:54  pm, Chuck Hill wrote:

Have you been naughty?

http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/ Main?wikiPage=EOFC
ommandments



Chuck

At 01:15 PM 22/10/2003 +0100, Merul Patel wrote:
Hi,

I have a component which works fine for editing, inserting and deleting
EnterpriseObjects of type A.


I've modified it to allow me to also edit a many-to-many relationship
between EOs of type A and EOGenericRecords of type B, by using a
WODisplayGroup to fetch all the objects of type B, and then using a
WOCheckBoxList to assign the selected type B objects to the type A
object. I've assigned the selections binding for the WOCheckBoxList to
A.AB many-to-many relationship.

The many-to-many relationship  and the WOCheckBoxList appear to be
configured correctly, and when I commit changes to be saved, the
changes are committed to the dbase by the
EOEditingContext.saveChanges() call. However, subsequent edits to the
many-to-many relationship aren't saved, even though I can see that the
editingContext has detected the changes by calling
EOEditingContext.updatedObjects().

If I create another session to the application, then the same thing
happens. I can make changes to the many-to-many relationship initially,
but then subsequent changes fail.


The above led me to believe I should refault the objects in the editing
context, but this has made no changes.


Am I missing something?

TIA,

Merul
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


--

Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Problem saving Many-to-Many relationship changes (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: WOHTML TemplateParser error
  • Next by Date: Re: <td background=resource-reference ...>
  • Previous by thread: Re: Problem saving Many-to-Many relationship changes
  • Next by thread: Re: Problem saving Many-to-Many relationship changes
  • Index(es):
    • Date
    • Thread