Re: Owns destination confusion
Re: Owns destination confusion
- Subject: Re: Owns destination confusion
- From: Gary Teter <email@hidden>
- Date: Thu, 28 Feb 2008 09:03:47 -0800
I think you only get the automatic destination creation behavior if
you have "propagates primary key" turned on for that relationship.
On Feb 28, 2008, at 8:50 AM, Florijan Stamenkovic wrote:
Hi all,
I've setup my "ContactJob" entity to relate to "Numbers" and
"Address" entities, and to own the relationships. Both are to-one
relationships with foreign keys in ContactJob, that do not have the
inverse relationship modeled. From my understanding this should
cause new "Numbers" and "Address" EOs to be created, inserted, and
related to the "ContactJob" as soon as I create and insert an
instance of "ContactJob". Am I wrong?
Coding with the above assumption, I get a NullPointerException
thrown when I try to access the relationships. I do this soon after
the creation of the "ContactJob", once I set the GUI values on it.
I call validateForSave() on the ContactJob, which is overriden to
call validateForSave() on the "address" and "numbers"
relationships. I need to do this coz Address and Numbers have per
EO custom validation rules.
I've triple checked my model. The foreign key to Numbers and
Address are set to not null. The relationships are both setup as
mandatory, cascading, and owns relationship. The only peculiarity
of the situation is that the inverse relationships are not modeled,
but I can't see how that matters. I've not overriden
awakeFromInsertion() in ContactJob...
Any ideas???
Flor
If this is normal and I just misunderstand, then I suppose I can
create and insert the Numbers and Address in ContactJob's
awakeFromInsertion(), and relate them, so I guess it's fixable.
Still, it does not seem normal to me.
--
The Ent visualization project:
http://wirehose.com/research/entvisualization
_______________________________________________
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