Class::DBI::Relationship::IsA issues with create()

[prev] [thread] [next] [Date index for 2005/02/25]

From: jldommer
Subject: Class::DBI::Relationship::IsA issues with create()
Date: 17:52 on 25 Feb 2005
Hi all,

I am using 'Class::DBI::Relationship::IsA' on a simple test database, and have run into problems with create().  I've set it up with a base class that establishes a connection to my database, and then I've set up the classes for the individual tables and declared the 'is_a' relationship.

#Base class
package TestDBIsA::ClassDBI;
use base qw(Class::DBI);
use strict;
use warnings;

my $dbh = TestDBIsA::ClassDBI->connection($dsn, $user, $password)|| die "Database connection not made: $DBI::errstr";


#Tables
package TestDBIsA::Person;
use base qw(TestDBIsA::ClassDBI);

package TestDBIsA::Artist;
use base qw(TestDBIsA::ClassDBI);

TestDBIsA::Artist->is_a( 'pid' => 'TestDBIsA::Person' );


I have run some simple tests and everything seems to be working with the exception of create().  I have found that I can call create() on my parent, 'Person', and everything works fine, but that when I call it on my child, 'Artist', I get an error message.

TestDBIsA::Artist->create( {
  artistid => 81,
  alias => 'Manet',
  pid => 2
  }
);

Can't insert new TestDBIsA::Person: DBD::Oracle::st execute failed:
ORA-01400:
cannot insert NULL into ("JLDOMMER"."PERSON"."PERSONID") (DBD ERROR:
OCIStmtExecute) [for Statement "INSERT INTO person (personid)
VALUES (?)
"] at /usr/lib/perl5/site_perl/5.8.0/DBIx/ContextualFetch.pm line 51.
 at /usr/lib/perl5/site_perl/5.8.0/Class/DBI/Relationship/IsA.pm line
257

I'm not sure what I've done wrong.  Does anyone have any thoughts?

Jennifer Dommer

Class::DBI::Relationship::IsA issues with create()
jldommer 17:52 on 25 Feb 2005

Generated at 17:56 on 01 Mar 2005 by mariachi v0.52