How do I override the GenerationType strategy using Hibernate/JPA annotations?

后端 未结 4 1042
野性不改
野性不改 2020-12-29 10:50

I\'m considering using Annotations to define my Hibernate mappings but have run into a problem: I want to use a base entity class to define common fields (including the ID

4条回答
  •  时光取名叫无心
    2020-12-29 11:09

    On the method in the child dont add the second @Id tag.

    @Override // So that we can set Generated strategy
    @GeneratedValue(strategy = AUTO)
    public Integer getId() {
        return super.getId();
    }
    

提交回复
热议问题