[Catalyst] Choosing the right ORM
Sam Vilain
sam at vilain.net
Mon Nov 28 23:10:01 CET 2005
On Mon, 2005-11-28 at 14:00 +0100, catalyst at augensalat.de wrote:
> When looking at Catalyst's manuals and examples the model is always
> based on Class::DBI.
>
> Whereas Catalyst very much meets most of my requirements, CDBI starts to
> become cumbersome if tasks are more sophisticated, e.g. handle many
> databases, mod_perl and Apache::DBI, m:n relations...
>
> There are other ORMs available, but only one, DBIx::Class gets some
> attention here.
>
> How about Alzabo or Rose::DB::Object or maybe others?
> Anybody here who has tried any of them and would share some experiences?
Whilst some may be disgusted by its use of surrogate IDs or the
appearance of the word "Schema" in its documentation, or "run screaming"
from its non-SQL query syntax that lets you build complex queries,
Tangram is an established and stable ORM which people are using today
with Catalyst.
DBIx::Class, from what I've seen so far, is probably the best of breed
for going from a relational database to a set of Perl classes with
minimal effort. I've seen lots and lots of modules which simply
reinvent the Class::DBI approach with different syntax but without
really doing anything much differently.
Tangram (and, for instance, Pixie) represents a different style of
persistence, sometimes called Prevalence or Object Persistence, which
maintains that the in-memory copy of objects is the master copy, and
that the database is merely used to store the objects and perhaps also
recognise relational information at the same time. In the case of
Pixie, no relations are stored - it just stores objects, indexed by
cookies which can be named. Tangram (as of 2.08 or so) supports this
too, but also lets you map object properties to relational columns via a
set of default or custom mappings. There are already 1:*, *:* and *:1
mapping types, with ordering or keying. Specific M:N relations, etc can
be implemented in the in-memory classes.
It really depends on what your programming approach as to which style
suits you.
I've seen lots of other persistence systems, but nothing that really
breaks either of those molds. Well, actually Pixie was quite different
so I assimilated its features into Tangram.
HTH,
Sam.
More information about the Catalyst
mailing list