An entity model with a key-many-to-one that uses joined inheritance always has to join the root table when querying a subclass, even if no attributes of the super types are used. This is unfortunately because the FK of the {{ToOneAttributeMapping}} uses the root table information for the mapping.
We should try to optimize this in {{org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper#interpretToOneKeyDescriptor}} to be able to avoid always joining.
Note that there is code which build builds on the current behavior, but I added a TODO comment with this Jira key along with explanation of what needs to be done. |
|