Re: Dynamically altering external names for Entities

Chuck Hill <[email protected]> Fri, 09 May 2003 15:51:03 -0700
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
I'll assume this is a legacy design that you can not alter.

What you are trying to do is not really what EOF is setup for so, while
doable, it might be painful.  EOModels are global, so you can not change
these on a session by session basis unless you create an whole new EOF
stack for each session.  That will work, but will consume large amounts of
memory.  Many of the delegate methods are probably also not suitable to use
for session specific functionality.

One thing you might want to consider is creating an abstract super-entity
to model the common table structure and then create a sub-entity inheriting
from this for each table.  This would allow each to have its own entity and
table name, but avoid having to model the table again and again.  The
session would then simply record the name of the entity it was using and
your code would use this when fetching.


Chuck



At 12:15 PM 09/05/2003 -0500, Mark Morris wrote:
>Hello!  I've been poking around the docs and haven't found a good solution
to something I think should be quite do-able.  I'm working with a schema
where there are many multiple instances of the same tables, just with
different names and data.  You typically only work with one "set" of these
tables at a time, so:  I want to define just one set of entities in my
EOModel, the use some WOSession variable to determine which actual external
table names get built in the SQL.
>
>It's simple to access any EOModels, spin through and setExternalName on
the appropriate entities, but I get the impression that's a global
operation, affecting every WOSession, so I'd rather find a solution that
affects the SQL generation directly.  I was also looking at a delegate on
the EOAdaptorChannel, but among other things I wasn't clear on how to make
sure the delegate get set on *all* of the adaptor channels the app might
create.  After that I might be able to get hold of the EOSQLExpression, but
I'm not yet sure how to alter that and continue the processing.
>
>Thanks for any help!  :-)
>
>-- Mark
>
>_______________________________________________
>EOF mailing list
>[email protected]
>http://www.omnigroup.com/mailman/listinfo/eof
>

--

Chuck Hill                                 [email protected]
Global Village Consulting Inc.             http://www.global-village.net