From: John D. <jo...@we...> - 2001-08-18 05:50:10
|
On Fri, 17 Aug 2001, Alex Black wrote: > >> I can see use in having separate "settings" for the database and the app. > > Jepp. I think this is neccessary. > > > > Another question. Can a entity span say parts of one or more tables? > > Something similar like a view in SQL? > > "Sort of" > > you can embed entity references (called pointers) in entity definitions. > > so you can say: > > user_id > user_name > user_password > address_id -> address > > i.e. "get the address entity with this id" > Yep. > > In the example the complete db entitys are mapped in the definition. And so > > querys are genearated for all fields. But that might me overhead. So I would > > like to define a entity that spans parts of tables. > > > > E.g. If I have a enty defined called "Subscriptions" that span the > > tables.fields: > > > > user.userId > > user.login > > smssubscriptions.userId > > smssubscritpions.serviceId > > emailsubscriptions.userId > > emailsubscriptions.serviceId > > > > but the tbl user has more fields I do not need to query for this entity. But > > for this one it's just fine. > > I don't see why not. I don't _think_ entityManager supprts that currently > but I have no problem with the idea as long as its implemented properly :) > It does support that; you have to specify the joins in a hierarchical array structure in the entity definition (that syntax could use some rethinking before we release as it was imported from an earlier abstraction layer). I can supply an example entity definition if there is interest. > ------------ > > Actually, along these lines: does anyone have any qualms about making this > assumption?: > > -Entity Field names must correspond exactly to table field names (we > could get rid of the schema map if we did this) > The schema structure is optional; if it's not present, we use the object structure, which is single-dimensional, instead. Odysseas or John C. will probably have better rationale for this than I do, but at least one example of where the schema mapping comes in useful is in building a generic public data access structure which could be used to automatically generate, for example, dtd's for XML access to these objects. Having a degree of independance between your data access structure's element names and your database field names could prove useful for cases like this. HTH -- John Donagher Application Engineer, Intacct Corp. Public key available off http://www.keyserver.net Key fingerprint = 4024 DF50 56EE 19A3 258A D628 22DE AD56 EEBE 8DDD |