AccessType not being inherited correctly when using @CollectionOfElements

Description

See attached test case.

To summarise, I have two @Entity classes, one of which contains a single @Embeddable ComponentA, the other of which contains a @CollectionOfElements of ComponentA. ComponentA in turn contains an instance of the @Embeddable ComponentB.

Both @Entity classes have the @Id on an instance field, so I understand that means that all embedded components should inherit that access type.

The test works fine for the @Entity which contains the single instance of ComponentA, but fails with an exception with the @Entity which contains the @CollectionOfElements. For some reason, the access type behaviour is lost when it gets to ComponentB - but only when I use @CollectionOfElements.

If I explicitly annotate ComponentB with @AccessType("field"), it works fine - but I shouldn't have to.

Attachments

1
  • 22 Apr 2008, 09:43 AM

Activity

Show:

Christian Bauer August 27, 2013 at 5:35 AM

I was just about to report the same issue, still a problem with 4.3 beta. The relevant JPA section for this requirement is JPA 2.1 section 2.3.3:

"The access type of an embeddable class is determined by the access type of the entity class, mapped superclass, or embeddable class in which it is embedded (including as a member of an element collection) independent of whether the access type of the containing class has been explicitly specified or defaulted."

KennyK April 22, 2008 at 9:45 AM

Forgot the version... tested with Annotations 3.3.0.GA

Duplicate

Details

Assignee

Reporter

Components

Priority

Created April 22, 2008 at 9:43 AM
Updated December 3, 2024 at 9:28 AM
Resolved March 28, 2016 at 7:10 PM