一.存储Annotation
@Entity@Table(name="t_goods")@Inheritance(strategy=InheritanceType.JOINED)public class Goods{ @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(name="gname") private String name; private float price; private String introduce; private int smallType; private String pic; ...}@Entity@Table(name = "t_goods_book")@PrimaryKeyJoinColumn(name = "id")public class Goods_Book extends Goods{ private String writer; private String publisher; private String publish_time; ...}
二.查询
查询后向下转型即可