Date: 2005-02-14T15:24:18 Editor: MichelleCaisse Wiki: Apache JDO Wiki Page: EmployeeInsuranceMapping URL: http://wiki.apache.org/jdo/EmployeeInsuranceMapping
no comment New Page: This is the proposed mapping for the employee/insurance bidirectional relationship. Key features of this mapping are: *The insurance table contains a foreign key to the persons table. *The MedicalInsurance and DentalInsurance reference fields of Employee are mapped-by the employee field of Insurance. {{{ <class name="PartTimeEmployee"> <inheritance strategy="superclass-table"/> <field name="wage" column="wage"/> </class> <class name="FullTimeEmployee"> <inheritance strategy="superclass-table"/> <field name="salary" column="salary"/> </class> <class name="Employee"> <inheritance strategy="superclass-table"/> <field name="hiredate" column="hiredate"/> <field name="weeklyhours" column="weeklyhours"/> <field name="dentalInsurance" mapped-by="employee"/> <field name="medicalInsurance" mapped-by="employee"/> <field name="department" column="department"> <foreign-key/> </field> <field name="fundingDept" column="fundingdept"> <foreign-key/> </field> <field name="manager" column="manager"> <foreign-key/> </field> <field name="mentor" column="mentor"> <foreign-key/> </field> <field name="protege" column="protege"> <foreign-key/> </field> <field name="hradvisor" column="hradvisor"> <foreign-key/> </field> <field name="reviewedProjects" mapped-by="reviewers"/> <field name="projects" mapped-by="members"/> <field name="team" mapped-by="manager"/> <field name="hradvisees" mapped-by="hradvisor"/> </class> <class name="Person" table="persons"> <inheritance strategy="new-table"> <discriminator strategy="class-name" column="discriminator"/> </inheritance> <field name="personid" column="personid"/> <field name="firstname" column="firstname"/> <field name="lastname" column="lastname"/> <field name="middlename column="middlename"/> <field name="address"> <embedded> <field name="street" column="street"/> <field name="city" column="city"/> <field name="state" column="state"/> <field name="zipcode" column="zipcode"/> <field name="country" column="country"/> </embedded> </field> <field name="phoneNumbers" table="employee_phoneno_type" > <join column="personid"/> <key column="type"/> <value column="phoneno"/> </field> </class> <class name="Insurance" table="insuranceplans"> <inheritance strategy="new-table"> <discriminator strategy="class-name" column="discriminator"/> <inheritance/> <field name="insid" column="insid"/> <field name="carrier" column="carrier"/> <field name="employee" column="empid"> <foreign-key/> </field </class> <class name="DentalInsurance"> <inheritance strategy="superclass-table"/> <field name="lifetimeOrthoBenefit" column="lifetimeOrthoBenefit"/> </class> <class name="MedicalInsurance"> <inheritance strategy="superclass-table"/> <field name="planType" column="planType"/> </class> }}}