On 10/25/05 8:02 AM, Sean Davis wrote:
> No Rose::DB::Object-derived class found for catalog '' schema 'public' table
> 'g_main' at /Library/Perl/5.8.6/Rose/DB/Object/Metadata/Auto.pm line 402.
> No Rose::DB::Object-derived class found for catalog '' schema 'public' table
> 'ug_main' at /Library/Perl/5.8.6/Rose/DB/Object/Metadata/Auto.pm line 402.

These are actually warnings, not errors, BTW.  You could actually silence
them by passing a "no_warnings => 1" argument to your calls to
auto_initialize(), but it's better to actually eliminate them, when possible.

> Methods for the following relationships and foreign keys were deferred and
> then never actually created.
>
> TYPE            NAME
> ----            ----
> Relationship    unigenes
>
>  at /Library/Perl/5.8.6/Rose/DB/Object.pm line 1054
>     Rose::DB::Object::AUTOLOAD('AnnoDB::Model::Gene::Main=HASH(0x18014ac)')
> called at rosetest.pl line 24

That's an error :)

> package AnnoDB::Model::Unigene::Main;
> use AnnoDB::Model::Gene2Unigene;
>
> use base qw(AnnoDB::Model);
>
> __PACKAGE__->meta->table('ug_main');
>
> __PACKAGE__->meta->relationships
>   (
>    genes =>
>    {
>     type => 'many to many',
>     map_class => 'AnnoDB::Model::Gene2Unigene'
>    },
>   );
>
> package AnnoDB::Model::Unigene::Main::Manager;
> use Rose::DB::Object::Manager;
> our @ISA = qw(Rose::DB::Object::Manager);
>
> sub object_class{'AnnoDB::Model::Unigene::Main'};
>
> __PACKAGE__->make_manager_methods('ugmain');
>
> 1;

You forgot to call auto_initialize() in AnnoDB::Model::Unigene::Main.

Fixing that should make things work...but doesn't due to some bugs.  I
guess I never tested a double auto-init-ed many-to-many relationship! 
(I'll be amending the test suite to do so.)

Anyway, I've fixed the problem in CVS (and in the tarball I just
emailed you) but you'll still get a warning when you auto-init the map
table.  It's a chicken and egg problem.  Had you used the technique
shown in the ManyToMany POD (i.e., using initialize() instead of
auto_initialize()) there'd be no warnings.  But auto-init is a bit
more aggressive about seeking out the classes it needs as soon as it
needs them.  It'll end up not finding one of them, and then it'll emit
a warning because it can't be sure that it'll *ever* find the class it
needs.

I'm debating silencing this warning permanently, but I'm not sure
that's a good idea.  If auto-init can't find a class for a foreign
key, I think I should speak up.  Because like I said, it can't know if
it'll ever be able to find an appropriate class.  There's no way to
know when the "last" RDBO class has been loaded, so I can't know when
my chances of finding an appropriate class are over.

Anyway, if you know better (i.e., if you know that you will indeed
load an appropriate class in your code), you can silence these
warnings by changing the auto-init line in the map class
(Gene2Unigene) to this:

    __PACKAGE__->meta->auto_initialize(no_warnings => 1);

Let me know if everything works with the CVS version that I just emailed you.

-John


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to