On Sep 28, 2011, at 9:08 AM, Ed Leafe wrote:
>> File "f:\py\dabo\db\dCursorMixin.py", line 386, in execute
>> raise dException.DBQueryException(errMsg)
>> DBQueryException: (1048, "Column 'wrmstid' cannot be null")
>
> That means that the getPK() call for wrmst is returning None, which
> indicates a problem with the bizobj.
>
> I have your test code from an earlier message; instead of constantly
> going back and forth and getting your tests, I think I'll try to reproduce
> what you're running to see if I can get this working correctly. I'm not sure
> when I'll have the time to get to it, so if you don't hear from me for a few
> days, please send me an email to remind me.
OK, I got your code working, but not before fixing several things.
First, you have a column 'wrmstnm' that is marked as NOT NULL, but with no
default value. When you try to associate a value to the mdlmst record, if that
value isn't found, the record is added. Unless the field you are using to
associate is 'wrmstnm', there will be no value, and the insert will fail.
Probably the bigger problem is that you are associating PKs, rather
than actual values. This is never a good idea; PKs should be used by the
database to identify records, but not by humans. Think of it this way: you
don't want to associate the warranty with PK=2 with the model with PK=1;
instead, you want to associate the "30-day" warranty with the "Basic" model. To
do that, you'd call:
mdlBizObj.mmAddToBoth(wrBizObj, "mdlmstnm", "Basic", "wrmstnm", "30-Day")
If either of those values do not exist in their respective tables, they
will be added, and the association created.
Does that make it clearer?
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]