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.