[hibernate-dev] Another @Access quandry

Steve Ebersole steve at hibernate.org
Wed Mar 26 15:05:09 EDT 2014


Hardy, not sure where you are looking...  But in master Course3 DOES NOT
use @org.hibernate.annotations.AccessType...


On Wed, Mar 26, 2014 at 2:01 PM, Hardy Ferentschik <hardy at hibernate.org>wrote:

>
> On 26 Jan 2014, at 05:13, Steve Ebersole <steve at 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
>
>
>
>
>
>
>


More information about the hibernate-dev mailing list