Hi Henrique,

On Sep 19, 2009, at 8:09 AM, Henrique Prange wrote:

Hi all,

Is there a way to configure EOF to access separate databases for each tenant in *one* application?

I'm working in an application that has a strong non-functional requirement on multi-tenant architecture with isolated database access.

I've seen some discussion related with this subject, but it was not clear to me how could I implement this kind of stuff.

Any directions are really appreciated.


The easiest, and perhaps best, way to do this is to have different instances for each tenant. The configuration (in JavaMonitor or elsewhere) can then specify the database.

Pros:
- easy
- problems / load on one tenant do not impact others
- guaranteed that one tenant will not accidently see information from another


Cons:
- more instances to administer
- some increase in RAM usage due to duplicated loading of code and JVM


If you don't want to do that and are committed to doing this in one instance, the next best way is to tag the root object with the tenant. But you said "separate databases", so that is ruled out.

The only way that I can think of to accomplish what you want is to create an EOModelGroup for each tenant. A separate copy of each model will need to be loaded into each group and the database connection information set for that tenant. Each EOModelGroup will serve as the basis for a new EOF stack (rooted at EOObjectStoreCoordinator). When a session is created, you will need to ensure that all editing contexts created for that session use the correct EOObjectStoreCoordinator. You will also want to ensure that you don't use default<Anything> in your code (defaultEditingContext(), defaultModelGroup() etc.) as these are unlikey to return objects from the correct EOF stack. Caveat: this is theoretical, I don't have any experience doing this. I don't think that many people have done this, so you run the risk of finding bugs in seldom executed EOF code.


Chuck


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to