On 26 Jan 2014, at 05:13, Steve Ebersole <steve(a)hibernate.org> wrote:
> From the test
org.hibernate.test.annotations.access.jpa.AccessMappingTest#testExplicitPropertyAccessAnnotationsWithHibernateStyleOverride
we have the following:
@Entity
@Access(AccessType.PROPERTY)
public class Course3 {
private long id;
...
@Id
@GeneratedValue
@Access(AccessType.FIELD)
public long getId() {
return id;
}
...
}
The test asserts that this is a valid mapping. Granted that the spec is
very unclear here, so I might be missing something. The pertinent spec
section here states:
For what its worth, I think the mapping is not valid (according to my interpretation of
the spec).
@Access(AccessType.FIELD) would need to be specified on the field to take effect. Whether
this mapping
is valid in a sense that is ignores @Access(AccessType.FIELD) is a different question.
However, referring to your test, afaics the test and class in question (Course3) uses
@org.hibernate.annotations.AccessType("field”) which is a different thing altogether.
Here we are dealing
with the now deprecated org.hibernate.annotations.AccessType annotation. AFAIK, this
annotation used
to be placed together with other mapping annotations.
So what do we want to discuss here really?
—Hardy