Yes, if you're using the normal access level (property), you should
never use field access except in the getter and setter methods. This includes inside the equals() and hashCode() methods. Hibernate's docs mention this in a roundabout way, and I think they should make it clearer, but there you go. Here's one of way it's mentioned.
Section 19.1, "Fetching Strategies":
refdocs wrote:
Proxy fetching - a single-valued association is fetched when a method other than the identifier getter is invoked upon the associated object.
This is the default for access="property", the default.
refdocs wrote:
Lazy attribute fetching - an attribute or single valued association is fetched when the instance variable is accessed. This approach requires buildtime bytecode instrumentation and is rarely necessary.
This is the default for access="field", which presumably you have not turned on.
I think that the documentation for access and default-access should describe their effects on user code as well as on hibernate code, because it does not emphasize the potential pitfalls enough.. imo.