i cant get the join to work for the dbix class. below are my 2 tables - i have removed the unnecessary columns. I am trying to perform the SQL query: "select * from image_folder as f, image_description as d where f.name = 'japan' and f.id=d.folder_id". i have tried following the dbix documentation to no avail. any suggestions?

package WorldTravelBlog::Model::DB::ImageDescription; use strict; use warnings; use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("image_description"); __PACKAGE__->add_columns( "id", { data_type => "INT", default_value => undef, is_nullable => 0, size + => 11 }, "folder_id", { data_type => "INT", default_value => undef, is_nullable => 0, size + => 11 }, "name", { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 64, }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( "folder_id", "WorldTravelBlog::Model::DB::ImageFolder", { id => "folder_id" }, ); 1;
package WorldTravelBlog::Model::DB::ImageFolder; use strict; use warnings; use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("image_folder"); __PACKAGE__->add_columns( "id", { data_type => "INT", default_value => undef, is_nullable => 0, size + => 11 }, "name", { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 64, }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( "image_descriptions", "WorldTravelBlog::Model::DB::ImageDescription", { "foreign.folder_id" => "self.id" }, ); 1;

In reply to DBIx join problem by jsmith2012

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.