John Siracusa <[EMAIL PROTECTED]> writes:

> The primary key generator will only be called when attempting to
> insert() an object that has an undef value in one or more of its
> primary key columns. 

Hello John,

thank you for your response. :)

I load() the row of the "basic table" using 'with' to load the related 
CMP_NETWORK.

Column definition (CMP_NETWORK):
NETWORKID     => { type => 'scalar', length => 255, not_null => 1 },
...
primary_key_columns => [ 'NETWORKID' ],

(I've also tried to add 'primary_key => 1' to the NETWORKID column.)

Relationship definition (CMP_SYSTEM):
CMP_NETWORK => {
    class      => '...',
    column_map => { SYSTEMID => 'SYSTEMID' },
    type       => 'one to many',
},

When I look at the load()ed data, all seems fine. But later on, after

    $row->init( %$data );

where $data contains something like

{
    'CMP_NETWORK' => {
        'NICADDRESS' => 'a01010101011'
    },
    'HWLASTSCANDATE' => '2008012114:33:00'
}

RDBO tries to insert() into the CMP_NETWORK table, just like you guessed. The
question is: Why?

Here's a snipped dump of the $row object _after_ $row->init():

'CMP_NETWORK' => [
    bless( {
...
'__xrdbopriv_modified_columns' => {
    'NICADDRESS' => 1,
    'SYSTEMID' => 1
},
...
'NICADDRESS' => 'a0101010101a',
'SYSTEMID' => 'MAT.SYSTEMID.000007'

I think the basic mistake is to use init(), because it removes the row data from
CMP_NETWORK, just leaving the differences I determined earlier in my code. So,
the NETWORKID value is missing afterwards. You can surely show me a better way. 

> You should probably pass $db to your Manager call in the function
> above, otherwise it will call $class->init_db to create a new one.

Oops... Thanks.

Greetings, Bianka





-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to