I have four classes that map to four tables
ClassType, MainClass, SubClassOne, SubClassTwo
ClassType maps to the table "Class_Type" and consists of two attributes
1) Class_Type_Cd C(4) Not Null PK
2) Class_Type_Desc VC(40) Not Null
MainClass maps to the table "Main_Class" and consists of three attributes
1) Main_Class_ID Integer Not Null Auto_Generated PK
2) Class_Type_Cd (FK from Class_Type)
3) Main_Class_Name VC(40) Not Null
SubClassOne maps into the table "Sub_Class_One" and consists of two attributes
1) Sub_Class_One_ID Integer PK (Dependent upon Main_Class_ID)
1) Int_Value Integer Not Null
SubClassTwo is the same as SubClassOne, with a String_Value (as opposed to an Int_Value)
I would like to join the MainClass with either SubClassOne or SubClassTwo, based upon the value of the ClassTypeCd (fk into the MainClass)
I am using annotations, and cannot for the life of me figure out how to use the key value as opposed to a set
string value, I would like to be able to set the below...
@DiscriminatorColumn(name="???", discriminatorType=DiscriminatorType.STRING)
where "??? is the value of this.getClassType().getClassTypeCd()
that way I can use the ClassType Description to get at the subclass from the MainClass
Does anyone have an example of how to do this?
Thanks, in advance, Thomas
PS - this is not a homework question, I'm trying to come up with a template to effectively add subtype tables to a schema without going into my main (superclass/supertype) constructs