-->
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: Question about inheritance and interface implementation.
PostPosted: Fri Jan 14, 2011 12:27 am 
Newbie

Joined: Fri Jan 14, 2011 12:15 am
Posts: 1
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.


Top
 Profile  
 
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.