[Seaside] Persistence in VW

Alan Knight knight at acm.org
Wed Dec 12 14:54:39 UTC 2007


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.

At 06:01 AM 12/12/2007, Oleg Richards wrote:

>Boris!
>
>What about my other questions (inheritance, integer storage)? Can you
>recommend me something?
>
>Oleg
>
>
>
>Boris Popov-2 wrote:
>> 
>> No, we have our own db mapping framework at the core of our application.
>> With GLORP there is quite a bit of flexibility as far as your mapping is
>> concerned, but it has relational db as the store, so you would need to be
>> familiar with it somewhat. Other options are gemstone, boss files or xml
>> :)
>> 
>> Cheers!
>> 
>> -Boris
>> (Sent from a BlackBerry)
>> 
>> ----- Original Message -----
>> From: seaside-bounces at lists.squeakfoundation.org
>> <seaside-bounces at lists.squeakfoundation.org>
>> To: seaside at lists.squeakfoundation.org
>> <seaside at lists.squeakfoundation.org>
>> Sent: Tue Dec 11 22:14:01 2007
>> Subject: Re: [Seaside] Persistence in VW
>> 
>> 
>> Hello Boris and Michael!
>> 
>> Thanks for your advises. I want to ask for a few more questions:
>> 
>> I have a lot of inheritance: Template - Flow template; different kind of
>> rows; reconciliated report. How will they work?
>> 
>> Currently i am storing all data in class side dictionaries and a lot of
>> binding was done with dictionaries too. Can i keep them or i should remake
>> bindings for the relation needs through ids. 
>> 
>> Should i keep my dictionaries or i should make afinders un database in
>> place
>> of them?
>> 
>> And main problem: I have a report object which stores a values in hash
>> where
>> the row code (3 letter) is a key and money amount is a value. How can i
>> store this in db using glorp? I dont have special class for it, so how to
>> do
>> mapping? Can u show me example?
>> 
>> Boris are you using ActiveRecord and GLORP too? 
>> 
>> Oleg
>> -- 
>> View this message in context:
>> http://www.nabble.com/Persistence-in-VW-tp14283675p14289650.html
>> Sent from the Squeak - Seaside mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
>> 
>
>-- 
>View this message in context: http://www.nabble.com/Persistence-in-VW-tp14283675p14292647.html
>Sent from the Squeak - Seaside mailing list archive at Nabble.com.
>
>_______________________________________________
>seaside mailing list
>seaside at lists.squeakfoundation.org
>http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

--
Alan Knight [|], Cincom Smalltalk Development
knight at acm.org
aknight at cincom.com
http://www.cincom.com/smalltalk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20071212/61b7e1af/attachment.htm


More information about the seaside mailing list