• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multiple clients in single DB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple clients in single DB


  • Subject: Re: Multiple clients in single DB
  • From: Patrick Middleton <email@hidden>
  • Date: Thu, 26 Apr 2007 09:46:19 +0100


On 26 Apr 2007, at 02:33, Dave Elsner wrote:

Hi,

I have an WO5.3 application I want to deploy to five different clients, all have the same DB (Oracle) schema but different data. I would like to use a shared database with a new column in each table "client" that has the client ID. Then override awakeFromInsertion for all EOEntities to set the client ID and also add to the Application constructor a loop that sets an EOQualifier on each entity in the model limiting objects to the current client.

Questions:

* Is this the correct approach to solve this problem? (i.e not wanting to update X number of identical DB schemas every-time a change is made, keeping the data in the one location for reporting)

* I tried EOEntity.setRestrictingQualifier but that overrides any single table inheritance setup in the model. Is there away to merge two EOQualifiers?



Cheers
Dave

My solution to this was to add a new entity Client, and make this reachable from at least one other entity bearing useful data in your schema. Via keypaths and joins, this entity should then now reachable from any entity other interesting entity. You then use EOEditingContext delegate API http://developer.apple.com/ documentation/WebObjects/Reference/API/com/webobjects/eocontrol/ EOEditingContext.Delegate.html#editingContextShouldFetchObjects (com.webobjects.eocontrol.EOEditingContext,% 20com.webobjects.eocontrol.EOFetchSpecification to examine the EOEntity for any fetch about to be carried out and to selectively amend the fetch specification's quailfier to add another EOKeyValueQualifier to achieve the required restriction. If your code carries out custom fetches which need to bypass this restriction mechanism, pass yourself a flag in the EOFetchSpecification's userInfo dictionary.


This has worked very well for me in a number of apps since 1999, you don't need to tinker with EOF (everything is as per the EOModel) and all the required client ID stuff resides in a single table.


-- Patrick Middleton OneStep Solutions plc 351 London Road Phone: +44 (0)1702 426400 Hadleigh Fax: +44 (0)1702 556855 Essex. SS7 2BT Email: email@hidden England (MIME welcome)

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Multiple clients in single DB (From: Dave Elsner <email@hidden>)

  • Prev by Date: Re: Dynamically adding a derived attribute
  • Next by Date: Re: Dynamically adding a derived attribute
  • Previous by thread: Multiple clients in single DB
  • Next by thread: Re: Multiple clients in single DB
  • Index(es):
    • Date
    • Thread