[Pharo-project] [Pharo-users] [Pharocasts] New comment on SandstoneDb, simple ActiveRecord style persistence....

Stéphane Ducasse stephane.ducasse at inria.fr
Wed May 4 17:37:10 EDT 2011


something that would be good is to have SActiveRecord as a trait like in SqueakSave 
this way no need to change the superclass definition of your domain to save your objects.

Stef
On May 4, 2011, at 9:01 PM, laurent laffont wrote:

> On Wed, May 4, 2011 at 7:00 PM, Ramon Leon <ramon.leon at gmail.com> wrote:
> My general approach would be this sequence of steps, let's assume his
> class is called Person in collection var name people.
> 
> If Person has an initialize method, rename it to initializeOld.
> Change superclass of Person to SDActiveRecord.
> Person warmUp. to setup the store for this new class.
> people do: [:e | e initialize ] to invoke active records initialize
> setting up it's necessary inst vars and marking all people as new
> rename Person>>initializeOld back to Person>>initialize.
> people do: [:e | e save ]
> 
> Migration complete.
> 
> 
> 
> Thanks a lot Ramon, I add this to Pharocasts.
> 
> Laurent
> 
>  
> --
> Ramon Leon
> http://onsmalltalk.com
> 
> 
> On Wed, May 4, 2011 at 4:58 AM, laurent laffont
> <laurent.laffont at gmail.com> wrote:
> >
> > Someone knows ?
> > Laurent
> >
> >
> > ---------- Forwarded message ----------
> > From: Bernat Romagosa <noreply-comment at blogger.com>
> > Date: Wed, May 4, 2011 at 1:37 PM
> > Subject: [Pharocasts] New comment on SandstoneDb, simple ActiveRecord style
> > persistence....
> > To: laurent.laffont at gmail.com
> >
> >
> > Bernat Romagosa has left a new comment on your post "SandstoneDb, simple
> > ActiveRecord style persistence...":
> >
> > I was trying to migrate a simple image-based persistence app into Sandstone,
> > so I just recompiled my biz objects to be subclasses of SDActiveRecord, but
> > of course the objects I want to save are already created and "floating" in
> > the image, so when I try to save them I get an error as many instvars
> > haven't been initialized upon creating these objects (as they were already
> > there).
> >
> > Is there a way to automatically do this?
> >
> > Thanks!
> >
> > Bernat.
> >
> >
> >
> > Posted by Bernat Romagosa to Pharocasts at May 4, 2011 4:37 AM
> >
> 





More information about the Pharo-dev mailing list