[hibernate-dev] relational model for union-subclass
Strong Liu
stliu at hibernate.org
Thu Dec 6 11:37:25 EST 2012
having a design question, how should we model this
(correct me if I get this wrong)
for this inheritance hierarchy, the relational model of root entity is pushed to the sub entity, so the table of sub entity has all "root table" columns / pk
and depends on if root entity is abstract, there may or may not having a physical table for the root entity
we used this org.hibernate.mapping.DenormalizedTable to model a union subclass table, and also the Table class has a org.hibernate.mapping.Table#isPhysicalTable to tell schema tool if this table should be created or not
For the new Metamodel, as Gail and I discussed, we don't want to have some fake table even for the abstract root entity, NULL for the return value of EntityBinding.getPrimaryTable() is better and clean design.
but on the other hand, the DenormalizedTable design is quite simple to impl in the Binder ( I already get it works ), esp considering we bind root entity first and don't have second pass.
wdyt?
-------------------------
Best Regards,
Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio
More information about the hibernate-dev
mailing list