-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Retrieving objects based on type code
PostPosted: Fri Jul 01, 2005 12:28 pm 
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.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.