Armin -
What is the "extends" attribute of a class-descriptor for?
There is no documentation for this...


Armin Waibel wrote:

Hi Bobby,

Bobby Lawrence wrote:

Hello -
I am having some difficulty with extents - something that OJB should handle nicely.
I have a Project class persisted in a table called PROJECTS.
I have a Person class persisted in a table called PEOPLE.
I have a PrimaryInvestigator class that extends Person.
The PrimaryInvestigator class has some additional fields - like a projectId (which project they are the PI for).
The PrimaryInvestigator info that comes from a Person should still be stored in the PEOPLE table, but the PI-only info should be stored in a table called PROJECT_PI - basically a join table between PEOPLE and PROJECTS that looks like this:
------------
person_id
project_id



So you have a m:n relation between Project and People? Additionally PI has a 1:1 reference to Project (the projectId in PI)?

To map the inheritance between People and PI you can use a "super-reference"
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Classes+on+Multiple+Joined+Tables


but there are known issues with this kind of mapping (see release-notes, try to fix this till 1.0.4).

regards,
Armin


For some reason, I cannot get the mapping correctly. Can anyone give me some insight as to how to write the mapping?
I tried to use:
<class-descriptor class="PrimaryInvestigator" table="PROJECT_PI" extends="Person">
.....
</class-descriptor>


But there really is no documentation about how to use the "extends" attribute.
Even so, it doesn't work for me, OJB complains about not all fields being set for PreparedStatement insert of Person object.


I also tried to do:
<class-descriptor class="Person" table="PEOPLE">
.....
  <extent-class class-ref=PrimaryInvestigator">
</class-descriptor>

But that doesn't quite work either - and I don't want to have to store the name of the object in the PEOPLE table - as described in the docs if you use the same table for extents.

Can anyone help?

--Bobby


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


-- ---------------------------- Bobby Lawrence MIS Application Developer

Jefferson Lab (www.jlab.org)

Email: [EMAIL PROTECTED]
Office: (757) 269-5818
Pager: (757) 584-5818
----------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to