Re: Problem saving Many-to-Many relationship changes
Re: Problem saving Many-to-Many relationship changes
- Subject: Re: Problem saving Many-to-Many relationship changes
- From: email@hidden
- Date: Wed, 22 Oct 2003 13:54:06 CDT
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
If you don't use WOToManyRelationship, but instead implement your own
component to do what you want----you still, in my opinion, ought not to
use any custom methods in your actual EO class. The custom methods
should all go in a WOComponent class, not in the EO class. Leave the EO
methods alone, but bind your dynamic elements to cover methods in your
WOComponent that do the right thing, and are implemented in terms of the
unmodified EO methods.
It's possible that you get source for WOToManyRelationship or an
equivelent somewhere in the Developer/Examples directory installed by WO.
It would be worth looking around in there; if you can find the code for
WOToManyRelationship, you can modify it to do exactly what you want.
--Jonathan
On Wed, 22 Oct 2003 19:38:38 +0100 Merul Patel wrote:
> Thanks once more Jonathan,
>
> Just found that WOToManyRelationship does 90% of what I want without
> having to modify custom class methods. This is nice in a way, since I
> don't have to keep tabs on custom code that would need changing if I
> ever changed the EOModel, but annoying since it doesn't suit my
> requirements completely.
>
> BR
> Merul
>
> NB. I don't have any booleans in the relevant classes, but I am working
> with WO5.1.
>
> On Wednesday, October 22, 2003, at 06:45 pm,
> email@hidden wrote:
>
> > I don't entirely understand what's going on. It _might_ be an issue of
> > the 'reciprocal' relationship not working properly. Try using
> > addObjectToBothSidesOfRelationshipWithKey to modify the relationships,
> > or
> > else just use the built in WOToManyRelationship or WOToOneRelationship
> > components for the UI.
> >
> > It _might_ be an issue with flattened relationships. If you have a
> > flattened relationship for this many-to-many AND you expose the
> > intermediate join table---that's no good. You've got to do one or the
> > other. Use flattened relationships OR expose the join table.
> >
> > It might also be my current least favorite and hardest to explain WO
> > bug,
> > involving boolean values. If you have any boolean properties in any of
> > the three entities involved in the many-to-many, it could be this.
> > See:
> >
> > http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/
> > Main?wikiPage=Weird52EOFBug
> >
> > for a description of the bug.
> >
> > See also:
> >
> > http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/
> > Main?wikiPage=EOFCommandments
> >
> > for a list of some other things that you can do 'wrong' with EOF, that
> > can cause mysterious problems like the one you are seeing.
> >
> > Hope this helps,
> > --Jonathan
> >
> > On Wed, 22 Oct 2003 13:15:04 +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.
_______________________________________________
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.