Sounds like this would be a FAQ, but searching on PM, C:DBI list and wiki didn't come up with anything. Say I have the following tables:
org:
  - orgid
  - ...

parttype:
  - typeid
  - orgid
  - ...

orgpart:
  - opid
  - typeid
  - ...

And the C:DBI classes that define the following relationships:

Org->has_many(Parts => [ "PartType" => "parts"]); Org->has_many(Types => "PartType"); PartType->has_a(orgid => "Org"); PartType->has_many(parts => "OrgPart"); OrgPart->has_a(typeid => "PartType");

The problem is that when I try to delete an org, I get the following error: "org is not a column of OrgPart at /usr/lib/perl5/site_perl/5.6.1/Class/DBI/Relationship/HasMany.pm line 61". And to that I say, right, but why is C:DBI looking for it? Shouldn't it make the org object, cascade to it's PartType objects, and from there cascase to all the OrgPart objects that refer to each PartType?

(This is not the actual code, so it's possible something was lose in the translation - even though I did take great case to make sure I got all the relevant parts).

Any suggestions or pointers would be very welcome!

-- zigdon


In reply to Class::DBI cascading delete problem? by zigdon

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.