Access strategy not correctly inherited by Embeddable when used in @ElementCollection, resulting in ArrayIndexOutOfBoundsException (or PropertyNotFoundException).
Description
duplicates
Activity
Show:
Details
Details
Assignee
Unassigned
UnassignedReporter

Components
Priority
Created August 4, 2019 at 1:07 PM
Updated August 19, 2020 at 12:08 PM
I've created a test case for this issue: https://github.com/jvanheesch/hibernate-orm/commit/03a55c7fbff44613abc6c48cd4e942beb29d2750
Additional information:
Test case was based on another test case (https://hibernate.atlassian.net/browse/HHH-12985)
I tried to extract this issue from a webapp, where I have similar entities, but I ended up with a different error message (webapp: org.hibernate.PropertyNotFoundException).
Based on https://docs.jboss.org/hibernate/orm/5.1/userguide/html_single/chapters/domain/access.html, I believe the correct behavior should be as follows:
MyEntity should have field access, because @Id annotation is placed on a field.
This appears to work correctly (getTest() is not interpreted as a property, annotating MyEntity with @Access(AccessType.FIELD) does not change behavior).
MyEmbeddable should inherit access strategy from its owning entity.
This appears to work incorrectly, as I've found two workarounds for this issue:
Annotate the MyEmbeddable class with @Access(AccessType.FIELD)
Add getter & setter for description to MyEmbeddable.
Sadly, both workarounds are unsatisfactory.
Creating this test case took me way too long because of https://lists.jboss.org/pipermail/hibernate-dev/2017-October/016684.html, so maybe set-up can be improved?