When you post annotations on getters, Hibernate uses a property access strategy; when you place them in fields, Hibernate uses a field access strategy. However, you should not mix these strategies in the same object (or, more precisely, in the same inheritance hierarchy), unless you use @Access for small-scale control of the access strategy.
By default, Hibernate expects annotations to fit in the same way as @Id , so in your case, it expects @Id annotations.
source share