db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan <bboe...@tpg.com.au>
Subject Re: Extents and the various inheritance hierarchy mappings
Date Thu, 30 Oct 2003 03:17:44 GMT
Hi All,

Jakob asked me to post the following to the list.  The issue at heart 
is the 'uniqueness' of the primary keys and how it relates to mappings 
like the one used for test classes E, F1 and G1.



Jakob, Brian

Thanks for the email Jakob (and your patience).  The reason I've 
included Brian in on this one is I'd like to get his opinion on the 
validity of my assertions about the model and the mapping I've detailed 

Here's the relevant history to this email.  To the following exchange:

>>> hi brendan,
>>> to make it clearer: the primary key has to be unique within the 
>>> hierarchy defined in the repository (using extents).
>> Does an instance of G1 violate this rule (since it has a primary key, 
>> say 333, an entry in TABLE_G1 with ID=333, an entry in TABLE_F1 with 
>> ID=333 and an entry in TABLE_E with ID=333)?

Jakob answered:

> yes, if those classes are part of the same extent hierarchy (defined 
> in the repository).

I was afraid Jakob would answer yes.  ;-)  I personally cannot see any 
problem with defining a series of classes and table mappings in a 
similar way to E, F1 and G1.  And I can't see anything wrong with 
defining extents on E to include F1 and G1.

It's a bit hard to come up with a good argument based on the test 
classes E, F1 and G1 so I want to give a more detailed, real-life 
example where I would want to do just this sort of mapping and extents 
definition.  The example involves a typical 'instance' of the 
Entity-Role pattern.  See the attached JPG if you don't want to read a 
long-winded description.

Entity has a Name and zero or more Roles.  Each Role has a 
corresponding Entity.  There are two subclasses of Entity: Person (with 
a dateOfBirth) and School (with an Address).  There are two subclasses 
of Role: Teacher and Student (both require their Entity to be a 
Person).  A School has zero or more Teachers and zero or more Students. 
  I'll assume for the moment that both Teacher and Student belong to one 
only School.  There is a class called Class (with subject, time, etc.) 
which has one Teacher and zero or more Students.  Each Student has zero 
or more Classes and each Teacher has zero or more Classes.

View raw message