Your problem is that your tables are totally different. Your automatically generated schema data looks much different from mine. the columns are of different datatypes and two of your columns are allowed to be null. Here is what my schema file looks like:

use strict; use warnings; use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("books"); __PACKAGE__->add_columns( "id", { data_type => "INTEGER", is_nullable => 0, size => undef }, "title", { data_type => "TEXT", is_nullable => 0, size => undef }, "rating", { data_type => "INTEGER", is_nullable => 0, size => undef }, ); __PACKAGE__->set_primary_key("id");

Your problem is most probably that the SQL you used to create the tables does not work with the queries that the application is expecting from More Catalyst Basics:

-- -- Create a very simple database to hold book and author informati +on -- CREATE TABLE books ( id INTEGER PRIMARY KEY, title TEXT , rating INTEGER ); -- 'book_authors' is a many-to-many join table between books & aut +hors CREATE TABLE book_authors ( book_id INTEGER, author_id INTEGER, PRIMARY KEY (book_id, author_id) ); CREATE TABLE authors ( id INTEGER PRIMARY KEY, first_name TEXT, last_name TEXT ); --- --- Load some sample data --- INSERT INTO books VALUES (1, 'CCSP SNRS Exam Certification Guide', + 5); INSERT INTO books VALUES (2, 'TCP/IP Illustrated, Volume 1', 5); INSERT INTO books VALUES (3, 'Internetworking with TCP/IP Vol.1', +4); INSERT INTO books VALUES (4, 'Perl Cookbook', 5); INSERT INTO books VALUES (5, 'Designing with Web Standards', 5); INSERT INTO authors VALUES (1, 'Greg', 'Bastien'); INSERT INTO authors VALUES (2, 'Sara', 'Nasseh'); INSERT INTO authors VALUES (3, 'Christian', 'Degu'); INSERT INTO authors VALUES (4, 'Richard', 'Stevens'); INSERT INTO authors VALUES (5, 'Douglas', 'Comer'); INSERT INTO authors VALUES (6, 'Tom', 'Christiansen'); INSERT INTO authors VALUES (7, 'Nathan', 'Torkington'); INSERT INTO authors VALUES (8, 'Jeffrey', 'Zeldman'); INSERT INTO book_authors VALUES (1, 1); INSERT INTO book_authors VALUES (1, 2); INSERT INTO book_authors VALUES (1, 3); INSERT INTO book_authors VALUES (2, 4); INSERT INTO book_authors VALUES (3, 5); INSERT INTO book_authors VALUES (4, 6); INSERT INTO book_authors VALUES (4, 7); INSERT INTO book_authors VALUES (5, 8);

Your schema file also looks different. You auto generated it right?

-Actualize

In reply to Re^7: Catalyst: model & context object usage by actualize
in thread Catalyst: model & context object usage by marscld

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.