Register / Login
File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
Object Relational Mapping
hibernate: table per concrete class implicit polimorphism
posted 3 years ago
thanks to anyone helping me to learn.
I have an unusual mapping that I am trying to figure out how to do.
for lack of being allowed to give a more accurate example to my programming task.
I have 4 tables of lets say car, stereo, transmission, assembly_details
a car has a stero (zero or 1), a transmission, and zero or more assembly_details
a stereo has an asembly_details (1-to-1)
a transmission has an assembly_details. (1-to-1)
An assembly_details record may have one or more sub_assembly_details,
and a reference to it's parent either a car/stereo/transmission/assembly_details.
In Hibernate how do I say that assembly_details parent is either a car, a stereo, transmission, or assembly_details???
Is the proper solution to use "Table per concrete class using implicit polymorphism"
<any name="assembly" meta-type="string" id-type="long"> <meta-value value="CAR" class="Car"/> <meta-value value="STEREO" class="Stereo"/> <meta-value value="TRANSMISSION" class="Transmission"/> <meta-value value="ASSEEMBLY_DETAILS" class="AssemblyDetails"/> <column name="PAYMENT_CLASS"/> <column name="PAYMENT_ID"/> </any> .... <class name="AssemblyDetails" table="assembly_details"> ..... <property name="parent" class="assembly"/> .... </class> ....
CIAO Peter M. Cooke
Don't get me started about those stupid
Hibernate: Collection Mapping on Non-Primary Key
polymormsim related demos
Hibernate - Mapping foreign keys tables
Legacy and Hibernate1-2-M Mapping
WrongClassException: Object with id:1 was not of the specified subclass