Re: Owns destination confusion
Re: Owns destination confusion
- Subject: Re: Owns destination confusion
- From: Johann Werner <email@hidden>
- Date: Thu, 28 Feb 2008 19:31:19 +0100
Owning the relationship means that "Numbers" and "Address" objects
can't exist without a relation to a "ContactJob" object. That means
that if you remove e.g. a Number from ContacJob and saveChanges that
Number object will be deleted as it doesn't belong to any ContacJob.
jw
Am 28.02.2008 um 17:50 schrieb Florijan Stamenkovic:
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.
_______________________________________________
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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