Re: Setting a Default toOne Relationship
Re: Setting a Default toOne Relationship
- Subject: Re: Setting a Default toOne Relationship
- From: David Avendasora <email@hidden>
- Date: Thu, 18 May 2006 22:06:58 +0100
You see, I knew I was missing something obvious. And here I was
trying to override the setter for the relationship. Nothing like
trying to do it the hard way.
On May 18, 2006, at 7:20 PM, Chuck Hill wrote:
Not sure about client side, but the EC is a parameter to the
awakeFromInsertion method:
public void awakeFromInsertion(EOEditingContext ec) {
Chuck
On May 18, 2006, at 11:16 AM, David Avendasora wrote:
"// However you are creating or fetching the EO"
Yeah, this is the problem area I'm running into. I'm having a hard
time creating an EOEditingContext.
This is my first real customization of a class and I've never had
to reference the editing context before...
Maybe the question should be "How do I create/use and editing
context in Java Client?
Dave
On May 18, 2006, at 6:25 PM, Chuck Hill wrote:
On May 18, 2006, at 10:12 AM, David Avendasora wrote:
Hi all,
I know this has to be an incredibly simple thing to do, but I
can't seem to figure out how.
All I want to do is defaults so that when an object is
instantiated, it automatically has some of it's relationships
defined. It is VERY easy to do this for an attribute, but I just
can't get it to work for a relationship and I can't find in the
documentation how to do it.
I know the code belongs in the awakeFromInsertion() method.
Can anyone give me a pointer to where in the documentation to
look for this, or better yet a simple code fragment?
BTW, this is for a Java Client application, but I don't think
that matters, right?
With JavaClient, who knows? :-)
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(); // do first
RelatedObject ro = // However you are creating or fetching the EO
// I am assuming that eo is now fetched or inserted into ec
addObjectToBothSidesOfRelationshipWithKey(ro, "relatedObject");
}
That is how I do it.
Chuck
--
Coming in 2006 - an introduction to web applications using
WebObjects and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems. http://www.global-village.net/products/
practical_webobjects
--
Coming in 2006 - an introduction to web applications using
WebObjects and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/
practical_webobjects
_______________________________________________
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