Accessing identifier via Hibernate proxy fails when @Id is declared in non-public @MappedSuperclass

Hi,

I have a question about expected behavior when accessing an entity identifier via a Hibernate proxy.

Setup:

  • Hibernate ORM 6.x
  • Entity uses a @MappedSuperclass for the identifier
  • The @MappedSuperclass is package-private (not public)
  • The identifier accessor (getId()) is public
  • Access happens inside an active transaction

When calling getId() on a proxied association, Hibernate throws:

IllegalAccessException:
ByteBuddyInterceptor cannot access a member of BaseEntity

The same entity works fine when the mapped superclass is declared public.

What I want to clarify is:
Is it expected that identifier access via a Hibernate proxy requires the declaring @MappedSuperclass itself to be public?

If so, is this constraint documented anywhere?
If not, would this be considered an oversight or something worth documenting?

Thanks.

Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.