[squeak-dev] SandstoneDb question

Ramon Leon ramon.leon at allresnet.com
Mon Aug 25 22:39:50 UTC 2008


> Hi,
> I'm using SandstoneDb for a project... and I have this 
> (one-to-many) scenario:
> 
> a) Product as Parts
> b) a Part can be owner by a Product, or can be orphan
> 
> so, I have two roots: Product and Part
> 
> well, by design, Sandstone does not allow me to make a recursive 
> commit, and I have to make that commit by hand, something like this:
> 
> self product partsDo: [ :each |
> 	each isNew ifTrue: [ each commit ].
> self product commit.
> 
> but... I need this behaivor in many parts of my environment, so I 
> rewrited #commit, this way:
> 
> Product>>commit
> 	self partsDo: [ :each |
> 		each isNew ifTrue: [ each commit ].
> 	super commit.
> 
> My question is: is this design right? Is there another 
> -cleaner- way to 
> do this?
> 
> Thanks in advance,
> Esteban

I'd say that's not a good approach.  The problem is you're adding new Parts
to a Product, if Part can stand alone, then save them prior to creating the
relationship.  Relationships are between committed objects.  You're trying
to treat the Part as an aggreagte of Product when it clearly isn't if a Part
can exist without a Product.

Ramon Leon




More information about the Squeak-dev mailing list