No.
Hibernate must not require getter/setter method for Entity if using that field access type.
We possibly configure field access type
1. <hibernate-mapping default-access=”field|property|ClassName” >
2. <property access=”field|property|ClassName” >
3. @AccessType(“field|property|ClassName”)
If you using field access type, only can use field.
@Entity
@AccessType(“field”)
public class EntityExample {
@Id
private String id;
@ManyToOne
private AnotherEntity friend;
…
}
This time directly access to field by Reflection.
But consider from a different standpoint that problem why using getter/setter?
It may be considered point of view that how use Entity object.
If Entity is (rich) domain object, may require getter and setter method.
But Entity is only used to data container(or DTO), may not require setter method.
We had remove misunderstanding to certainly require getter/setter method when using Hibernate!