Hi,
I have a table, in which apart from other fields, i have the following 3 fields:
Table name: Component_Container
Fields:
Component_Type_Cd
Component_Id
Component_Version_Id
Suppose, my component_type_cd can have values ranging from 1 to 10.
And also i will have appropriate values set in component_id and component_version_id fields.
Now, if component_type_cd 3 represents a table ABC_COMPONENT mapped to class AbcComponent, then while retrieving Component_Container object, i would like to retrieve the AbcComponent object as well. So depending on the component_type_cd, would have to retrieve different TYPE of objects.
I thought of using sub-class approach, in which i would have each of the components declared as a sub-class of Component_Container. But, i dont think this is the right approach, since this would mean, each of the component types extends from component_container, which is NOT the case. In my case, my component_container, CONTAINS different TYPE of objects.
Is there any clean way of implementing this?
Thank you.
|