My apologies gentleman. I included a rather off the cuff analysis along with a rather terse description of the problematic behavior.

So please ignore any prior remarks regarding the cause of the problem and here is the observed behavior using the classic Product and Price classes as examples:

Here are two classes, the first works as expected the second fails with the listed error message:

Working class:

   package Product;

   use My::DB ;

   use base qw(My::DB::Object);

   __PACKAGE__->meta->setup
     ( table       => 'product'
     , columns     =>
         [ 'Id' => { type => 'integer', primary_key => 1, sequence =>
   'Product_Id_Seq' }
         #
         #  Name                                      Null?    Type
         #  ----------------------------------------- --------
   -------------------
         # 'Id'                                   #   Not Null Number(38)
         , 'Name'                                 #   Not Null
   varchar2(255)
         ]
     , unique_key => 'Name'
     , relationships =>
       [ Prices =>
        { class           => 'Product::Price'
         , key_columns     => { Id => 'Product_Id' }
         , type            => 'one to many'
         },
       ]
     ) ;

Class which does not work:

   package Product;

   use My::DB ;

   use base qw(My::DB::Object);

   __PACKAGE__->meta->setup
     ( table       => 'product'
     , columns     =>
         [ 'Id' => { type => 'integer', primary_key => 1, sequence =>
   'Product_Id_Seq' }
         #
         #  Name                                      Null?    Type
         #  ----------------------------------------- --------
   -------------------
         # 'Id'                                   #   Not Null Number(38)
         , 'Name'                                 #   Not Null
   varchar2(255)
         ]
     , unique_key => 'Name'
     , relationships =>
       [ Price =>
        { class           => 'Product::Price'
         , key_columns     => { Id => 'Product_Id' }
         , type            => 'one to many'
         },
       ]
     ) ;

Use of which results in the following error message:

Can't call method "Id" on unblessed reference at .../Rose/DB/Object/MakeMethods/Generic.pm line 3470.

The single change is that the name of the relationship is 'Prices' in the working version and 'Price'
in the broken version.  In both cases, the detail class is 'Product::Price'.

I've attached complete versions of the regional pricing both working and not working including test logs:

   regional-pricing/working/log/1.use.txt
   regional-pricing/working/log/2.new.txt
   regional-pricing/working/log/3.fields.txt
   regional-pricing/working/log/4.save.txt
   regional-pricing/working/log/5.load.txt

   regional-pricing/bug/log/1.use.txt
   regional-pricing/bug/log/2.new.txt
   regional-pricing/bug/log/3.fields.txt

With regional-pricing/bug/log/3.fields.txt containing the listed error message.

Philip Dye
School of Computer Science
Carnegie Mellon University
[EMAIL PROTECTED]

Attachment: regional-pricing.tar.z
Description: Binary data

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to