Well
you could handle this by doing the following: (I think)
You
should be able to simply map the two different objects to the same table. You
would just need to have to seperate <class> sections in your mapping file
that would use the same <map-to table="table-name"/>
value.
I
don't beleive castor has any problems mapping two different object to the same
table, but I could be wrong. It doesn't matter that they both extend person in
this case because all castor will care about is the final full class
name.
Hope
this helps you out.
-Nick
From: Joseph George-AGJ020 [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 3:35 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] CASTOR JDO & storing a super and sub classes in one DB table
Hello,
I am using Castor
JDO in my current project. I am trying to find an example of how to
store a super and sub
class into the same one table in the
db.
I.E STUDENT and PROF both extend PERSON
PERSON
String
name
String
ssn
STUDENT
String
gpa
Collection
Courses
PROF
boolean
tenured
String
FacultyName
I want have one
table called PERSON in the DB that would contain all fields in PERSON and those
found in PROF and STUDENT plus an extra field in the table and XML called
PersonType to distinguish between PROF and STUDENT. I've been looking for
a mapping.xml file code snippet that would show how to do
this.
Does Castor provide
a mechanism for doing this or is there extra code I need to write to handle
this?
I found how to write
the XML file so that each table has its own table but want to store all
three classes using one table.
If PERSON class is abstract does it make a diff?
Thanks,
George
---
Incoming mail is certified Virus Free.
Checked by AVG
anti-virus system (http://www.grisoft.com).
Version: 6.0.559 / Virus
Database: 351 - Release Date: 1/7/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.559 / Virus Database: 351 - Release Date: 1/7/2004
