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

Steve Ebersole steve at hibernate.org
Wed Mar 5 12:40:01 EST 2014


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.

Keeping these as distinct values alleviates that.  Thoughts?


More information about the hibernate-dev mailing list