Thinking about

On 9. 7. 2016, at 12:13, OC <[email protected]> wrote:

> For one, it would mean each DBTable eo would have its "records" relationship 
> leading into another target DBRecordXX entity; I am not sure whether this can 
> be modelled at all?

actually it would help a lot even without special FrontBase support.

My current setup is the very primitive

- DBTable entity, it has a :N relationship "records" into DBRecord
- DBRecord entity, which contains a FK into DBTable which models an inverse :1 
relationship "table" into DBTable.

A setup we all did a zillion times.

Now I wonder, might perhaps a horizontal inheritance help me to split those 
DBRecords? Let us assume that

(a) I add a "tableType" numeric column to DBTable; there would be N distinct 
table types
(b) I model N separate DBRecord1, DBRecord2, ..., DBRecordN entities, all of 
them children of DBRecord (which itself would become abstract)
(c) each of them would be linked to a separate SQL table

At the database level, this definitely would work well. What I can't see, how 
to process this at the model and EOF levels?

- I cannot model a relationship to “different entity for each row”; therefore, 
the target of the "records" relationship of DBTable would still have to be the 
(abstract) DBRecord;
- runtime, I would have tell _somehow_ to the EOF that if it is about to fire 
"records" of a DBTable object, it should fetch them from the 
["DBRecord%@",table.tableType] entity instead of from DBRecord -- the 
subEntityForEntity delegate method comes to mind
- when adding new records, I would simply use 
EOUtilities.createAndInsertInstance with appropriate entity name (e.g., 
"DBRecord33").

Should such a thing work, or am I in for a nasty surprise? I have actually 
tried, but either it should not work, or I messed up something else; instead of 
the desired result (or some intelligible error report) I am getting a very 
weird “Cannot register the database context for the model Shared” (which is 
*not* the model which contains my abstract/inherited entities). And, my 
subEntityForEntity delegate method is never called.

Thanks a lot,
OC



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

This email sent to [email protected]

Reply via email to