A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
Object Relational Mapping
hibernate: table per concrete class implicit polimorphism
Joined: Mar 16, 2004
Apr 10, 2012 12:23:09
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
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: hibernate: table per concrete class implicit polimorphism
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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015