| Attached SpringBoot JPA project with minimal configuration reproduces inheritance related JPQL queries bugs in Hibernate ORM. The idea is simple: create a query able to return mapped entities of certain type or all of them (when no type is supplied). First query findByClass from DAO works with SINGLE_TABLE inheritance, though is not JPA compliant. Second, findByTypeClass, never works resulting in bootstrap failure with misleading exception, though is recommended by documentation. Third, findByTypeString, works partially only with certain inheritance strategy. Fourth, findByClassIn, always works since it's pretty much documentation example, though it does not fulfill original goal and put there just for reference. Fifth, findByClassInNullSafe, is an extension of previous and works partially. Worth mentioning an interesting exception of findByClass with other but SINGLE_TABLE inheritance type used. Please, check project test cases for details. Seems, such inconsistency in Hibernate inheritance implementation exists since 3d version of ORM (according to *unresolved *similar Jira issues). Could someone elaborate on such behavior, suggest recommended/working example of query reaching same goal (common production task) or fix it in next Hibernate release. |