Can I annotate a member inherited from a superclass?

前端 未结 4 684
一向
一向 2021-02-13 20:02

If I have a class such as:

class Person {
  private String name;
  ...constructor, getters, setters, equals, hashcode, tostring...
}

Can I subc

4条回答
  •  灰色年华
    2021-02-13 20:09

    That wont work since the fields in super class will not be affected, but you can try this

    @Entity
    class Employee extends Person {
      @Column(name="xxx")
      @Override
      public void setName(String name) {
         super.setName(name);
      }
      ...
    

提交回复
热议问题