New answers tagged behavior
You can use JPA with inheritance. There are several variations ("patterns"): all objects share the same table and there is a "discriminant" column/attribute (this is the closest to the one you explain). It is quick for queries, but you will have a column for each attribute of a subclass (if you have 20.000 instances, and only two instances of a subclass ...
Top 50 recent answers are included