Reading entities using @MappedSuperclass does not work with classes in foreign packages

Description

 

java.lang.NoSuchMethodError is thrown when reading entity extending other class in different package,
when both classes (inherited and inheriting) are in same package problem disappears

Problems was noticed in Hibernate 6.2.3.Final with Spring Boot 3.0.0, In Hibernate 5 function worked correctly. (I am migrating my application to new Spring Boot 3.0.0)

To reproduce problem use attached example application, execute get endpoint

Attachments

4

Activity

Show:

Karol Jasłowski June 21, 2023 at 6:03 AM

Would you find time to also take a look on my other reported problem with hibernate?

Jan Schatteman June 19, 2023 at 11:07 PM

Thanks for the reproducers, in the original description I think I overlooked the fact that the inheriting class is package protected. I can now reproduce both issues, and indeed they appear to be a bug in Hibernate, potentially related to bytecode enhancement.

Karol Jasłowski June 19, 2023 at 10:00 AM
Edited

Hello Jan,

Thank you for your response, I created example test with usage of hibernate test case templates
hibernate orm demo mapped super class - read.zip

Could you take a look on it?

If you will change visibility of Inheriting class to public the problem will gone.

Jan Schatteman June 8, 2023 at 7:32 PM
Edited

I’ve tried this out on the main branch and it works fine, so I would wager that this is either a bug in Spring or maybe a configuration issue. In either case if you are convinced that this is a bug in Hibernate, please provide a pure Hibernate reproducer demonstrating that. You can use the hibernate template project to make this easier ( )

Edit: also tried it on the 6.2.2 tag which is what SB 3.0.0 includes (iinm), and there also it seems to work as expected.

Fixed

Details

Assignee

Reporter

Sprint

Fix versions

Priority

Created May 29, 2023 at 8:22 AM
Updated June 30, 2023 at 11:45 AM
Resolved June 22, 2023 at 11:41 AM