Does Hibernate always need a setter when there is a getter?

后端 未结 5 531
醉梦人生
醉梦人生 2020-12-08 18:01

We have some Hibernate getter methods annotated with both @Column and @Basic.

We get an exception if we don\'t have the corresponding sette

5条回答
  •  情话喂你
    2020-12-08 18:44

    You should annotate your classes with the @Entity(access = AccessType.FIELD) and annotate your attributes. This should solve your problem. The setter is the best way to support refactoring. And what's the problem with having the little setter there.

提交回复
热议问题