Ok, but... its still a good spring board to discuss this topic which is
strangely unclear and murky in terms of what we do and do not support.
On Wed, Mar 26, 2014 at 2:14 PM, Hardy Ferentschik <hardy(a)hibernate.org>wrote:
Hi,
you are right, the current code used @Access(AccessType.FIELD) -
https://github.com/hibernate/hibernate-orm/blame/master/hibernate-core/sr...
However, this is wrong. I actually looked first in my local checkout which
is a bit outdated, but there @org.hibernate.annotations.AccessType is still
used.
Judging by the test name this was clearly the intent of the test as well.
It seems the test got changed a month ago in order to fix test failures -
https://github.com/hibernate/hibernate-orm/commit/ff12d5c#diff-40
In this case the change was wrong. I guess the idea was to get rid of the
deprecated annotation use, but the whole test should have been deleted.
--Hardy
On 26 Jan 2014, at 20:05, Steve Ebersole <steve(a)hibernate.org> wrote:
> 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(a)hibernate.org>
wrote:
>
> 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
>
>
>
>
>
>
>