• 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: EOGenerator Relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOGenerator Relationships


  • Subject: Re: EOGenerator Relationships
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Wed, 17 Sep 2008 12:39:57 -0400


On Sep 17, 2008, at 11:46, Mike Schrag wrote:

Wonder's automatic inverse relationship stuff
What's that? Mind explaining briefly, or pointing out where it is in wonder?
On ERXGenericRecord:

* Also, this class supports auto-updating of inverse relationships. You can
* simply call <code>eo.setFoo(other), eo.takeValueForKey(other),
* eo.addObjectToBothSidesOfRelationshipWithKey(other, "foo")</code>
* or <code>eo.addToFoos(other)</code> and the inverse relationship will get
* updated for you automagically, so that you don't need to call
* <code>other.addToBars(eo)</code> or <code>other.setBar(eo)</ code>. Doing
* so doesn't hurt, though. Giving a <code>null</code> value of removing the
* object from a to-many will result in the inverse relationship getting
* cleared. <br />
* If you *do* call addToBars(), you need to use
* includeObjectIntoPropertyWithKey() in this method.<br>
* This feature should greatly help readability and reduce the number errors you
* make when you forget to update an inverse relationship. To turn this feature
* on, you must set the system default
* <code>er.extensions.ERXEnterpriseObject.updateInverseRelationships=tru e</code>.


The _Wonder.java templates check for this and can function in both scenarios properly. What this basically addresses are for things like where you bind a WOPopUpButton selection to a to-one relationship. All that does is set one side of the relationship, which is terribly confusing for people. This setting makes it so inverse relationships are always updated. There was a great debate about this a few months ago, actually ... You can search the archives for it.

Ah OK. I don't remember the debate. I was interested in this coz JBND also does both sides, but since DataObject has a different API then EOEnterpriseObject, it is simple to implement. Especially since I separated attribute setting from relating (set(...) and relate(...)), and also have unrelate(...). I guess this could have all be handled by a single more complex method, but what's done is done. The end result is the same, any relationship operations take care of the inverse stuff as well.


I don't think you actually need them ... EOF will do the right thing in the absence of the non-XxxRelationship set methods. That said, I don't actually use those templates -- I use _Wonder.java, but the addition of the setXxx methods I think is pretty recent (I think I only added them when I fixed automatic inverse relationship updating).

AFAIK you don't need them, but I think having them performs just a bit better. takeValueForKey(...) needs to do less reflection. Well, this is perhaps stretching it, since the KVC default implementations points out it is super-optimized (always wanted to see exactly what's going on in there), but I think I also read about this too, somewhere. Well, makes sense, though I have no idea what the performance hit of not having those methods would really be.


F
_______________________________________________
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


References: 
 >EOGenerator Relationships (From: Michael Kondratov <email@hidden>)
 >Re: EOGenerator Relationships (From: David Avendasora <email@hidden>)
 >Re: EOGenerator Relationships (From: Florijan Stamenkovic <email@hidden>)
 >Re: EOGenerator Relationships (From: David Avendasora <email@hidden>)
 >Re: EOGenerator Relationships (From: Michael Kondratov <email@hidden>)
 >Re: EOGenerator Relationships (From: Mike Schrag <email@hidden>)
 >Re: EOGenerator Relationships (From: Florijan Stamenkovic <email@hidden>)
 >Re: EOGenerator Relationships (From: Mike Schrag <email@hidden>)

  • Prev by Date: Re: EOGenerator Relationships
  • Next by Date: Re: EOGenerator Relationships
  • Previous by thread: Re: EOGenerator Relationships
  • Next by thread: Re: EOGenerator Relationships
  • Index(es):
    • Date
    • Thread