Annotations on fields in nested embeddable collection elements are ignored

Description

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.

Environment

None

Activity

Show:
Steve Ebersole
October 28, 2015, 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.

Gail Badner
March 28, 2016, 6:59 PM

HHH-10651 has a good test case for this.

Thomas Göttlich
September 30, 2016, 3:08 PM
Edited

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.

Steve Ebersole
September 30, 2016, 3:14 PM

Has the test case from HHH-10651 been applied upstream at all?

Gail Badner
October 4, 2016, 5:50 PM

, 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.

Assignee

Unassigned

Reporter

Gail Badner

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure