Setting up a repository

Chris Muller asqueaker at gmail.com
Thu Apr 17 02:37:59 UTC 2008


Hi Germán,

> business objects and, as I don't know another way, I tried (as stated on
> Getting Started):
>
>  MagmaRepositoryController
>  create: 'c:\myMagmaFolder'
>  root: Dictionary new

The getting started only uses a Dictionary because it doesn't want to
be partial to any sort of domain.  It is actually something I
recommend against doing nowadays.

> were instead "Dictionary new" I did "MySystem current" (the singleton
> instance that permit to reach all the objects of the system).

Now, you do NOT want to have your root persistent object continue to
be a referenced in the image by some class variable.  This will cause
the entire database to remain in memory and slow your commits to a
crawl, among other potential identity issues if you have multiple
users.

Instead, just treat the repository root as the new "location" of your
singleton instance, accessed by "mySession root".

> And here start the doubts:
>
> 1. Soon I get the serialization problem with the 10MB limit. How I should
> manage this situation to create the repository by parts, to avoid the size
> problem, doing commits more frequently if all I can do is point my whole
> system to #root: ?

If you have a large model already in the image that you need to
initially persist, you can simply eliminate the 10-meg safety limit
check and commit the thing in one big transaction.  Be patient, it may
take a while, but its a one-time thing.  Once committed, you can
reinstate the safety check and access the model normally.

> 2.  If the system were little (not problem with the serialization limit),
> only doing the above sentence I get the repository and the objects
> persistent?

I may not be reading what you're asking here correctly, but I think
the answer is yes.  You can do "one big commit" just for the initial
"load" and then after that your application program should commit
single "units of work", changes to the model that must be committed as
a whole (like a monetary transfer from one account to another), but
only that unit of work, as is reasonably feasible.

> 3. Is acceptable to use a class that inherits from Object instead Dictionary
> (as in the example) to point the root object? Considerations of each
> alternative?

Yes, not only is it acceptable, it is recommended to use a meaningful
domain object as your root instead of a not-so-meaningful Dictionary.

> 4. Is acceptable/possible to have more than 1 repository to 1 system ?

Yes, not only is it acceptable, it is recommended to partition your
domain by meaningful boundaries.  For example, in my system I separate
the Accounting domain from the Contacts; each in their own repository,
even though Accounts reference Contacts residing in the other
repository.  This is accomplished via MagmaForwardingProxy.

This partitioning provides many benefits.

> Well, it's all for now, sorry if are so simple questions, but as I've said,
> I'm stating with Magma.

Cheers,
  Chris


More information about the Magma mailing list