I'm struggling to solve something that I think is rather peculiar and was
hoping someone could provide a pointer.  It happens in some code that tries
to obtain the object from a "... to one" relationship.

foreach my $relobj (@relationships) {
        my $type = $relobj->type;
        my $relname = $relobj->name;
        next unless ($type eq 'many to one' or $type eq 'one to one');
        my $egsubobj = $egobj->$relname;

This code works fine for other classes but for one class when I do the
$egobj->$relname line, it fails with

"Could not load MG::Country with key  "

Have attempted to debug the Rose MakeMethods\Generic.pl file. By simply
adding a line to show the args as object_by_key is entered, I get this:

Entering object by key:
Rose::DB::Object::MakeMethods::Generic
delete_countryname
args:required - ,relationship - ,hash_key - ,interface - ,share_db -
,key_columns - ,class - ,
options:preserve_existing - , target_class - ,
Entering object by key:
Rose::DB::Object::MakeMethods::Generic
countryname
args:required - ,relationship - ,hash_key - ,interface - ,share_db -
,key_columns - ,class - ,
options:preserve_existing - , target_class - ,
Entering object by key:
Rose::DB::Object::MakeMethods::Generic
delete_address
args:required - ,relationship - ,hash_key - ,interface - ,share_db -
,key_columns - ,class - ,
options:preserve_existing - , target_class - ,
Entering object by key:
Rose::DB::Object::MakeMethods::Generic
address
args:required - ,relationship - ,hash_key - ,interface - ,share_db -
,key_columns - ,class - ,
options:preserve_existing - , target_class - ,

Now, the thing is that countryname is a valid onetoone relationship for this
class.  But "address" is not!  address is not specified at all.
Now the obvious thing would be that I've made a mistake and specified an
address relationship for the MG::Country class somehow.  I've cetainly not
done this in any way that I can find and I have scoured all the packages for
"address" etc. and it all looks fine.  But "address" is a valid relationship
for another class so it possible that Rose defines inerited classes in a way
that I don't understand somehow?

thanks,

James Masters.


-------------------------------------------------------------------------
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