I think that is just an oversight back to the original impl of the JPA
metamodel. I cannot speak for the tests. I can definitely see the
argument for PluralAttribute#isAssociation logically returning false for @
ElementCollection.
The spec is very unclear about it unfortunately. WRT entities actually the
term I see more often in the spec is "relationship".
Personally I logically segment collections exactly the way you suggest,
so +1 from me. The only really consideration I guess is compatibility.
But still, +1 from me.
On Thu, Jun 23, 2016 at 4:37 PM Gail Badner <gbadner(a)redhat.com> wrote:
Currently, Hibernate's implementation of
javax.persistence.metamodel.PluralAttribute#isAssociation always returns
true. I haven't found anything in JSR 338 (yet) that refers to an element
collection as an association.
I don't see a good definition of "association", but the term is used with
respect to entities. I also see examples of @ElementCollection with
@AttributeOverride, but none with @AssociationOverride.
The change suggested in HHH-10888 is to have
PluralAttributeImpl#isAssociation return true only for one-to-many and
many-to-many. I believe this is correct, but it breaks a couple of tests
that specifically check if an element collection is an association.
I wanted to pass this by you in case I'm missing something here.
Please take a look at the pull request to see the fix and the required
test changes. [1]
Thanks,
Gail
https://github.com/hibernate/hibernate-orm/pull/1447