Re: Simple newbie question on relationships

[prev] [thread] [next] [Date index for 2004/12/02]

From: Tom Hukins
Subject: Re: Simple newbie question on relationships
Date: 16:04 on 02 Dec 2004
On Thu, Dec 02, 2004 at 07:24:50AM -0500, Sean Davis wrote:
> As the title implies, I am new to Class::DBI.  I have the following set 
> up (see below--of course, there is a base package...).  However, in a 
> minimal example, it fails.
> 
> [holmes:~/annotation/perl/pg] sdavis% perl -MProbeDBI -e '0'
> has_a needs a valid column at 
> /Library/Perl/5.8.1/Class/DBI/Relationship/HasA.pm line 12
> Compilation failed in require.
> BEGIN failed--compilation aborted.

Do you have separate files defining each class?  If the code you
posted exists in the same file, you try to define a has_a relationship
to ProbeDBI::db before defining this class.

You can either break the classes into separate files or declare
relationships after defining each package.

> __PACKAGE__->table('db');
> 
> __PACKAGE__->sequence('db_db_id_seq');
> __PACKAGE__->columns(All => qw/db_id db/);

Above, you don't explicitly specify your primary columns (see "Declare
your columns" in Class::DBI's documentation).  Do you have a reason
for not doing this?

I hope that helps,
Tom

Simple newbie question on relationships
Sean Davis 12:24 on 02 Dec 2004

Re: Simple newbie question on relationships
William Ross 13:48 on 02 Dec 2004

Re: Simple newbie question on relationships
Tom Hukins 16:04 on 02 Dec 2004

Re: Simple newbie question on relationships
Sean Davis 17:58 on 02 Dec 2004

Re: Simple newbie question on relationships
Tom Hukins 11:21 on 03 Dec 2004

Generated at 12:00 on 04 Dec 2004 by mariachi v0.52