Ok, no wonder I couldn't create a dummy test case.

What happened was this - I already had a number of rudimentary RDBO 
objects that I'd created manually.

In this particular case, I had a table 'user' and a table 'company', 
with a FK relationship between user.company_id and company.company_id.

All of this was already properly created by hand following RDBO 
best-practices, with RDBO::User and RDBO::Company in my @INC.

What would happen was that I would run:

my $loader =
    Rose::DB::Object::Loader->new(
                                  db                 => My::DBH->new(),
                                  base_class         => 'My',
                                  class_prefix       => 'My::',
                                  with_foreign_keys  => 1,
                                  with_relationships => 1,
                                  with_unique_keys   => 1,
                                  with_managers      => 1,
                                  module_dir         => $output_dir,
                                 );
$loader->make_modules();


And I would get the following error:

Can't override class My::User::Manager which already appears to be 
defined. at /home/peter/dev/proj/trunk/CPAN_lib/Rose/DB/Object/Loader.pm 
line 947

If I disabled with_managers, things would execute to completion, but 
then the resulting user module would be created with a double entry for 
primary keys as follows:

     primary_key_columns => [ 'user_id', 'user_id' ],

Which was extremely confusing.

It was just now that I removed the previously-created RDBO::User object 
that I created by hand a while back, and now everything works properly.

Doh.

Thanks all,

Peter




Peter Leonard wrote:
> The problem is more that the schema I have is large enough that I was 
> hoping to come up with a more straightforward example that properly 
> demonstrated the issue.  ;)
> 
> Ovid wrote:
>> ----- Original Message ----
>> From: Peter Leonard <[EMAIL PROTECTED]>
>>
>>> I'm still trying to create a simple test case to demonstrate it.  It's 
>>> definitely related to the presence of foreign keys in the database, but 
>>> so far the stripped-down schemas I've built don't replicate the issue.
>> Have you thought about using mysqldump with the --no-data option?  That will 
>> just dump your schema and you can run the loader against that.  Or is it 
>> something a bit more involved than that?
>>  
> 
> -------------------------------------------------------------------------
> 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

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