[hibernate-dev] Separating javax.persistence.AccessType and org.hibernate.property.PropertyAccessor

Emmanuel Bernard emmanuel at hibernate.org
Thu Mar 6 07:22:31 EST 2014


On Thu 2014-03-06 11:30, Hardy Ferentschik wrote:
> 
> On 5 Jan 2014, at 18:40, Steve Ebersole <steve at hibernate.org> wrote:
> 
> > Historically annotation binding within Hibernate made a huge assumption
> > that AccessType and PropertyAccessor were the same thing.  They aren't
> > necessarily.  AccessType is simply meant to dictate where to look for
> > annotations relating to "persistent attributes".  PropertyAccessor is
> > Hibernate's way of accessing property values (getting/setting) at runtime.
> > 
> > Granted, AccessType *by default* should indicate the PropertyAccessor to
> > use.  I am not arguing that.  I am just suggesting that we should keep both
> > as distinct values.  At the moment we collapse them into a single String
> > (we dump AccessType and keep "PropertyAccessor name").
> > 
> > The trouble is that later on we sometimes need to know the AccessType, at
> > which point we are forced to make a guess by interpreting the
> > PropertyAccessor in use and hoping that a custom PropertyAccessor was not
> > supplied.
> 
> I don’t know where it is exactly where you need the distinction, but if you do,
> I also think they should be kept separated. Also having distinct concepts for this maybe 
> makes concepts also a bit clearer. 

AccessType in JPA means both but is also much more limited than our
PropertyAccessor approach. If your plan is to separate them in the
metamodel, then +1 and if propertyAccessor is not set, fall back to
JPA's default behavior.


More information about the hibernate-dev mailing list