-->
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: Generic Entity: Is it possible ?
PostPosted: Tue May 08, 2007 1:44 pm 
Newbie

Joined: Tue May 08, 2007 1:41 pm
Posts: 1
Hello everyone,

I have an application that groups different objects using a Category entity.
Of course, with Java5 Generics it is possible :

Code:
public class Category<E extends BaseObject> extends BaseObject
{
   private String categoryName;

   private List<E> entidades;

   private Long id;

   private List<Category<E>> subCategories;

        ... getters, setters, hashcode, equals, toString
}



However the Category Entity must be persisted via Hibernate. This is where I'm lost.

The only way I can think of resolving this is that the CAT table must be connected to the Entities like this :

CAT --> CAT_ENTITY_1 --> ENTITY_1
CAT --> CAT_ENTITY_2 --> ENTITY_2
...
CAT --> CAT_ENTITY_N --> ENTITY_N

Is my idea ok?, or does someone has another approach to the "Generic Entity", or should I forget about the Generic
entity ?

Thanks.


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.