I think you can make it work, but it is going to need a database connection for 
each slave.  And there can’t be relationships between slaves or between the 
master and the slave.  And it is going to be susceptible to “bad assumption” 
errors in Wonder (I think that version of EOF is OK).

What you would need to do is to create a new EOModelGroup for each slave and 
copy (not a reference, a brand new object) the models into it, adding the 
schema to the table names.  That avoids the need to tweak the SQL. They you 
need to create a new EOObjectStoreCoordinator for each of these groups.  
EOObjectStoreCoordinators don’t co-operate so the duplicate GID should be OK.  
Then make sure that your code uses the correct EOObjectStoreCoordinator to 
create EOEditingContexts in.

I *think* that will work, I have never tried it.  Using the 
EOSharedEditingContext with objects in the slave tables is going to challenging 
as a lot of code is going to assume that there is only one, not per 
EOObjectStoreCoordinator.  I’d avoid the EOSharedEditingContext.  The other 
place where you may run into problems is notifications that are not scoped to 
the EOObjectStoreCoordinator.

But all in all, this is not really what EOF is meant for.  With EOF you would 
use a different data model for this sort of multi-tenant solution.

Chuck

From: Webobjects-dev 
<webobjects-dev-bounces+chill=gevityinc....@lists.apple.com> on behalf of Paul 
Hoadley <pa...@logicsquad.net>
Date: Friday, December 15, 2017 at 2:22 AM
To: André Rothe <andre.ro...@phosco.info>
Cc: WebObjects-Dev <webobjects-dev@lists.apple.com>
Subject: Re: Using database objects in different schemas

Hi André,

On 15 Dec 2017, at 6:33 pm, André Rothe 
<andre.ro...@phosco.info<mailto:andre.ro...@phosco.info>> wrote:

But how does EOF differ the objects? They come from different tables (but with 
the same name, only the owners differ). The owner I would intercept and change 
in the SQL code. Can EOF track this without a model? Also the primary keys 
could overlap, because the "slaves" use its own sequence objects, which all 
start at 1.

Unless Chuck chimes in with some serious esoterica, I cannot imagine how you’d 
get this to work. No, EOF won’t be able to track that without a model. And even 
if you could somehow trick it into using a union of several tables, then, and I 
think you know this, they’re not really going to function as primary keys if 
they can possibly collide.


At the moment I havent't found a delegate for the SQL injection, so I cannot 
test it :-(

I don’t think it’s going to help. I just can’t see how EOF can be the solution 
to this problem.


--
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/


 _______________________________________________
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

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

Reply via email to