inheritance - Mixing table per subclass and per hierarchy in hibernate -


There are two tables in my database The first table, the table ABSTRACT , keeps three columns

  id, type, sometext  

This table contains all the abstract information abstract classes abstract now two tables concreteon and CONCRETETWO contains all information for concrete squares concrete one and concrete two . Now I know that I can use Suburban Strategy per table to create mapping with heritage to do with hibernate. But as I have a column that marks the type of concrete implementation, can it be possible to prepare some mixed behaviors such as a sub-class strategy with a participant?

Heritage Mapping Strategy should be selected based on database design.

If you can not change the database design, stay with the best strategy for the current DB design. I.e table per subclassic strategy

If you can change the database design, first forget about hibernate, note which DB table design is better for your application. To consider some factors, a) How will the data be brought / used? Suppose, most of the time, if there is no concern about the separation of concrete and concrete, then logic does not have any meaning to go to the sub-tables. B) How many extra columns are needed for concrete and concreteટો? If you have a lot of columns for sub tables, "Authorization of table per class" is not a good idea. C) The specific columns for the sub-tables should not be "no-null".

Hope this will help.


Comments