[jboss-user] [JBoss Seam] - Class Inheritance and the EntityHome Framework Class

trickyvail do-not-reply at jboss.com
Fri May 18 15:14:46 EDT 2007


I've been using a
 public class BaseHome extends EntityHome<Base>
class to manage persistence for a collection of sub class entities that inherit from Base. 

For sub classes which have been persisted to the database things work as expected. I can setId(), getInstance(), and persist state changes to the database.

I would like to create new entities using BaseHome, but I need a way to specify which concrete subclass should be instantiated. Here's what I've tried to do:
public class BaseHome extends EntityHome<Base>
  | {
  |         @Override
  |         public void create()
  |         {
  |                 setEntityClass(Subclass.class);
  |                 super.create();
  |         }
  | }
  | 
  | public class Subclass extends Base{}
  | 
With the result:The method setEntityClass(Class<Base>)
  | in the type Home<EntityManager,Base>
  | is not applicable for the arguments (Class<Subclass>)

Am I using the EntityHome framework in a manner that was never intended? Should I  build my own bean for managing this object heirachy?

As always, I greatly appreciate the insights the members of this forum share.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046913#4046913

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046913



More information about the jboss-user mailing list