My Header.pm:
use utf8;
package TJATest::Schema::Result::Header;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table("header");
__PACKAGE__->add_columns(
"header_id",
{ data_type => "nvarchar", is_nullable => 0, size => 8 },
"header_name",
{ data_type => "nvarchar", is_nullable => 0, size => 16 },
);
__PACKAGE__->set_primary_key("header_id");
__PACKAGE__->has_many(
"details",
"TJATest::Schema::Result::Detail",
{ "foreign.header_id" => "self.header_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2012-06-21 10:57:34
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dlqmQqCFLzrg5Oyy0OkjaQ
# You can replace this text with custom code or comments, and it will be
preserved on regeneration
1;
and my Detail.pm:
use utf8;
package TJATest::Schema::Result::Detail;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table("detail");
__PACKAGE__->add_columns(
"header_id",
{ data_type => "nvarchar", is_foreign_key => 1, is_nullable => 0, size =>
8 },
"detail_id",
{ data_type => "nvarchar", is_nullable => 0, size => 8 },
"detail_name",
{ data_type => "nvarchar", is_nullable => 0, size => 32 },
);
__PACKAGE__->set_primary_key("header_id", "detail_id");
__PACKAGE__->belongs_to(
"header",
"TJATest::Schema::Result::Header",
{ header_id => "header_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2012-06-21 10:57:34
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RoARw2LXtvRN8PNvTMq7rQ
# You can replace this text with custom code or comments, and it will be
preserved on regeneration
1;
-Tim
On Thu, Jun 21, 2012 at 3:59 PM, David Stevenson <[email protected]> wrote:
> My money is on you not declaring your primary keys correctly - such that
> you ended up with detail_id as the primary key
>
> What's the DB schema?
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/[email protected]
>
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]