Currently we are using JOINED inheritance type. We have a specific case where 2 descendant entities have a many-to-one association with same attribute name. The problem is that Hibernate uses only first found attribute in entity hierarchy and the next one (with same name) will be ignored. Unfortunately the TREAT keyword doesn't help and the only workaround is to rename these attributes (for instance with indexes).
I found this problem at two places in AbstractEntityPersister:
2. At the end of getSubclassPropertyTableNumber(String propertyPath):
I've attached a test case which executes the following JPQL:
It leads to following SQL:
I think the key of attribute caching should contain the entity type as well and TREATing should have an effect on alias calculation.
Spring Boot - HSQL / PostgreSQL