Re: EOF Stumper (for me at least)
Re: EOF Stumper (for me at least)
- Subject: Re: EOF Stumper (for me at least)
- From: Lon Varscsak <email@hidden>
- Date: Mon, 18 May 2009 15:14:39 -0700
Unfortunately, that's not my issue. :) I think what you're describing takes place on to-one relationships (but I may be remembering it incorrectly too). However, the editingContext only has one OrderDetailSale object in it.
Thanks for your attempt though!
-Lon
On Mon, May 18, 2009 at 2:54 PM, Luke Holton
<email@hidden> wrote:
Lon,
This sounds vaguely like a problem I fought through a few
years ago. If I remember correctly, my problem was caused
because I didn't realize EOF was creating the related object
(in your case the OrderDetailSale object) automatically
because you have both the "owns destination" and "propagate
primary key" selected. I notice you indicate here you are
explicitly creating the ORderDetailSales object which would
give you, in this case, "two" objects; one of which is not
initialized properly leading to the "orderLineNumber is not
null" message.
It's been quite a while so I wouldn't be surprised if I'm
"mis-remembering" the details here. Hopefully it won't lead
you astray.
Regards,
Luke Holton
Tel: (602) 279-4600 ext 622
Fax: (602) 279-4768
Desert Sky Software: www.desertsky.com
Specializing in the Development and Hosting of
e-Business Applications.
On Mon, 18 May 2009, Lon Varscsak wrote:
I'm having a problem where sometimes a compound primary key value that I assign myself, get's
overwritten to null somewhere and the insert statement fails.
OrderHeader (primary key orderNumber)
->> OrderDetailSale (to many relationship, primary key orderNumber & orderLineNumber; both owns
destination and propagates primary keys checked)
1. create an OrderHeader object
2. create (and assign to the OrderHeaderObject) an OrderDetailSales object
3. assign regular property values
4. set orderNumber on the orderHeader object (only this object, because I want EOF to assign it to the
detail relationship; which it does)
5. set orderLineNumber on OrderDetailSales object
6. save.
When I save Sybase complains that the order_line_number column cannot be NULL. However, the object
DOES have orderLineNumber assigned (and so does it's snapshot). When I log out the
EOAdaptorOperation's changedValues it has orderLineNumber as null (which is wrong and bad).
The worst part of this is that without any code changes sometimes it works and sometimes it fails
(meaning sometimes orderLineNumber is written to the adaptor op properly and therefore the
database...but not always).
I have changed "propagates primary keys" and propagated it myself by overriding the setOrderNumber
method on OrderHeader (and then passing it down to OrderDetailSale) and the error goes away completely.
I'd prefer not to do this as it really does propagate orderNumber which I want, it just seems to
be occasionally trampling orderLineNumber.
Any ideas?
Thanks,
Lon
P.S. -- Using WO 5.4.3 & Project Wonder from about a month ago.
_______________________________________________
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