Hi all, I'm sure someone has to have asked this before, but I've been searching for a good long while now and have found no definite answer to a problem like this.
I'm building a package where several classes use inheritance to complete the functionality for an end product, and use interfaces at a number of steps in order to define objects that have a consistent set of methods and whatnot. Basically standard polymorphism. As an example situation I have the following
AbstractPlayer ---- Player extends AbstractPlayer ----> myAppPlayer extends Player
and
AbstractNonplayer --- Nonplayer extends AbstractNonplayer ----> myAppNonplayer extends Nonplayer
where the Abstracts define the hibernate properties tables and fields, the middle Player and nonPlayer objects define server methods, and the top level myApp players and nonplayers implement app specific code.
Then I have a Person interface, and a PersonID component-id, which has an ID number which is shared between the player and nonplayer tables, and a personType field which tells whether the player is a player or nonplayer and which app he is a player or nonplayer on. The purpose of this interface is to define things like skills, interactions, and server methods that are identical in use between players and non-players regardless of app, and is implemented by Player and NonPlayer above. As a result I have a number of places where I will use a Set<Person>. Hibernate is less than fond of me doing this, and I have yet to figure out what combination of magic I need to perform in order to get this type of polymorphism to work.
Some assistance would be invaluable.
|