On 11/22/06 9:51 PM, [EMAIL PROTECTED] wrote: > $found->[0]->name("otherproduct"); > $found->[0]->vendor({name => "othervendor"}); > $found->[0]->update(); > > > The problem doesn't occur if the line > > $found->[0]->vendor({name => "othervendor"}); > > gets taken out. If the database requires NOT NULL for the vendor key, > the update() operation causes a DB error. > > Any hints?
Try calling save() and not update(). If you look at the docs for the "get_set_on_save" method made for the "vendor" foreign key, you'll see this: http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/MakeMethods/Ge neric.pm#object_by_key --- ... get_set_on_save Creates a method that will attempt to create and load a Rose::DB::Object-derived object based on a primary key formed from attributes of the current object, and save the object when the "parent" object is saved. --- In the HTML docs, the the "save" portion of the word "saved" is a link to the save() method. IOW, the stuff described happens only when save() is called. Calling update() will not trigger it. The docs are not very emphatic on this point, and it's probably because update() and insert() were previously internal, undocumented methods. When I made them public, I should have added clarification regarding the newly multiple ways to save an object. I'll make a note to update the docs in the next release. -John ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object