[hibernate-dev] Bytecode enhancement and field-access

Steve Ebersole steve at hibernate.org
Fri Aug 7 19:41:15 EDT 2015


In working through the document overhaul I ran across the following passage
in the JPA specification:

<quote>
The persistent state of an entity is represented by instance variables,
which may correspond to JavaBeans properties. An instance variable must be
directly accessed only from within the methods of the entity by the entity
instance itself. Instance variables must not be accessed by clients of the
entity. The state of the entity is available to clients only through the
entity’s methods—i.e., accessor methods (getter/setter methods) or other
business methods.
</quote>

(from section "2.1 The Entity Class" in the JPA 2.1 specification).  Notice
that the spec explicitly calls out that even with field access the
expectation is that the application still access the state via methods.  In
other words our concept of "extended enhancement" is actually beyond the
spec.


More information about the hibernate-dev mailing list