jpa学习-table-per-class

    xiaoxiao2021-12-14  21

    警惕自己这个知识点:

    import javax.persistence.*; @Entity @Table(name="animal") @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)//设置了这个后,主键就不能采用默认设置 public class Animal { @Id @GeneratedValue(strategy=GenerationType.TABLE) private Integer id; private String name; private Integer foot; public Animal(String name, Integer foot) { super(); this.name = name; this.foot = foot; } public Animal() { super(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getFoot() { return foot; } public void setFoot(Integer foot) { this.foot = foot; } }
    转载请注明原文地址: https://ju.6miu.com/read-971738.html

    最新回复(0)