springboot jpa继承问题,谢谢解答。
问题描述:
@Entity(name = "Account")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public static class Account {
@Id
private Long id;
private String owner;
private BigDecimal balance;
private BigDecimal interestRate;
}
@Entity(name = "DebitAccount")
public static class DebitAccount extends Account {
private BigDecimal overdraftFee;
}
最终在数据库中生成了Account表,DebitAccount表,能否不生成Account表,只要DebitAccount表,谢谢各位帮忙
答
不想生成哪个类的映射表,别加@Enttity注解就可以了 , 拿你上边的例子来说DebitAccount 类上的注解去掉就可以了。