[Seaside] Persistence in VW

Oleg Richards orichards at mail.ru
Wed Dec 12 17:57:28 UTC 2007


Thank you Alan!

I will look at this classes. I need a little help with ActiveRecord? Can you
show me how to use it? I understand that i should inherit all my models from
AR class, but what next. Should i execute something in workspace? And how to
attach session  to active record? 





Alan Knight-2 wrote:
> 
> Inheritance is always rather tricky against a relational database, because
> the concept really isn't there, so you have to map it into some
> compromise, trading off space, query time, and flexibility. Glorp supports
> two different strategies for this, which we call horizontal and filtered.
> Filtered inheritance means all instances are stored in one bit table, and
> there's a field which indicates which type this row represents. This is
> efficient to query, but wastes spaces. Horizontal is where each subclass
> is represented by an entirely separate table. This is more likely if
> you're trying to impose an inheritance hierarchy on an existing database,
> and minimizes storage, but makes querying more complex. Some kinds of
> queries can be inefficient. You'd want to look at the TypeResolver class
> and its subclasses. In the Glorp tests, GlorpInheritanceDescriptorSystem
> has some examples.
> 
> By comparison, storing integers and dictionaries is pretty easy :-) If you
> want both key and value to be simple types, then you need a table
> somewhere to store them. If the value is an object, you can either have
> the key be part of the value's table, or in a link table.
> GlorpDictionaryMappingTest and GlorpEncyclopediaDescriptorSystem have
> examples.
> 
> Neither of those things is likely to work automatically with the
> GlorpActiveRecord code, you'll likely have to write out the mappings. But
> part of the point of the way GlorpActiveRecord is done is that you can let
> the parts that are easy get built automatically and only have to specify
> the tricky parts.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Persistence-in-VW-tp14283675p14300415.html
Sent from the Squeak - Seaside mailing list archive at Nabble.com.



More information about the seaside mailing list