JPA queries involving MappedSuperclass are failing in latest Hibernate or Spring Boot 3 projects.The same worked fine in Spring boot 2 or Hibernate 5. Steps to reproduce: 1. Create Mapped Superclass inheritance using XML in spring boot 3 project. 2. Create Jpa repository for base type. 3. Create JPA Query having Base class attributes GitHub steps:
- Checkout repository https://github.com/amitmahajanus/relationbook.git
- run below command in the terminal in the project directory
- mvn clean package
- mvn spring-boot:run
- compare the results after changing spring boot version to 2 and adding javax instead of jakarta dependencies.
Root cause: The SQM fails to find parent class attributes and project fails to load/run. The same works fine with Spring Boot 2 or Hibernate 5 project. Impact:
- Requiring to implement JpaRepository for each sub type and do lots of boiler plate code (querying sub type tables combining data and filtering)
- Spring Boot 3 upgrade or Hibernate 6 upgrade / migration will fail.
Attacing a sample project github link https://github.com/amitmahajanus/relationbook.git. Please compare spring boot 2 and spring boot 3 (having hibernate 5 and 6 respectively) |