[EMAIL PROTECTED] wrote:
Hello,
I have a question concerning advanced O/R-mapping. Suppose you have three class A, B, C. Suppose that both A and B have a collection of C. Suppose furthermore that every C instance is in exactly one of these collections.
When I map this to a relational database, I might want to have four tables A, B, CA, CB, such that CA contains those C instances that are associated to an A instances (and analogously for B instead of A).
This way, the table in which a particular C instance is stored, is determined at runtime.
OJB cannot do that, I think.
The only way I see is to define C as abstract and to have concrete subclasses CA and CB.
in the repository you can than have an extent definition for C that contains CA and CB.
But is it an esoteric idea? I have that situation in my application and I am a bit disappointed that I have to split class C just because I map it to a database.
In my eyes it's a bit against the relational model to split up an entity over two logical tables.
On the logical level it does not matter if a foreign key to C "comes from" A or B.
Of course it can make sense to have a physical layout of the C entity that keeps data in different tables. But this is a physical aspect that can be solved with database partioning and should not be visible on the application (logical) level.
my 2c, Thomas
Olli
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
