Annotations on fields in nested embeddable collection elements are ignored
Description
duplicates
is duplicated by
Activity
Former user October 4, 2016 at 5:50 PM
@Steve Ebersole, I see a commit for this jira has a test case: https://github.com/hibernate/hibernate-orm/commit/decb673bddd5b31ea24b8dbfef04ae728e21dfe4 .
I don't remember if the commit is the same test case, but it does reproduce the issue.
Steve Ebersole September 30, 2016 at 3:14 PM
@Former user Has the test case from HHH-10651 been applied upstream at all?
Thomas Göttlich September 30, 2016 at 3:08 PMEdited
This issue seems to apply to version 5.1 as well. In our case we have field access for all properties except the identifier due to not trigger a lazy load when just calling getIdentifier().
If you have a look at line 1445 of CollectionBinder in version 5.1 you'll notice that the access type is being guessed based on the identifier's access type, which in our case happens to be "property" (and which is the only field to have that access type). We're using version 4.3.11 at the moment and found it there so I can't tell whether it really applies to 5.1 but that portion of the code seems to be the same so it's very likely.
There's also a comment "FIXME support @Access for collection of elements" which indicates a solution for the problem.
Former user March 28, 2016 at 6:59 PM
HHH-10651 has a good test case for this.
Steve Ebersole October 28, 2015 at 3:25 AM
As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.
When AccessType.FIELD is used, annotations on a field in an @Embeddable will be ignored if it is nested in an @Embeddable used as a collection element.
There is no problem when AccessType.PROPERTY is used.