roman has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
modeling a DBIC classes hierarchy I went into a problem which must have been solved thousand times.
I have a base class, which instances are straightforwardly serialized into a table (object attribute is a table column) via DBIx::Class.
Then I have an extension class, with additional attributes also to be serialized into database.
I (intuitively) created a new table containing only the extending attributes and foreign key referencing the base table.
So for one logical object I have two physical rows in a database. Is there a way how to reasonably represent such subclass using DBIx::Class, i.e. to have DBIC instance working (insert, update, search) with two (more) records at once?
I would like to avoid a "pure database" solution based on updateable database view.
I can use "inline" view as the table. Of course they are not updatable.
select * from ( select ... from table1, table2 where ... ) where ...
I appreciate any clue and hope for simple answer like: "... well known problem with many good solutions, just see the discussion at ...".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extension of DBIC "model" class
by CountZero (Bishop) on May 09, 2008 at 16:03 UTC | |
by roman (Monk) on May 09, 2008 at 19:56 UTC |