父类:

@Entity 
@Table(name="tbl_AlbumSuper") 
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) 
public class AlbumSuperClass {
    @Id
    @Column(length = 32)
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(strategy = "uuid", name = "system-uuid")
    private String strID;    
    @Column
    private String strName;    
}

 子类:

@Entity
public class VideoAlbum extends AlbumSuperClass{
         //写一些子类特有的属性,如:
  @OneToMany(fetch=FetchType.EAGER)
    @JoinColumn(name="FK_album_ID")
    private Set<Video> videoSet;   
}





Video实体中专辑对象为父类对象
@ManyToOne(cascade=CascadeType.ALL)

@JoinColumn(name = "FK_album_ID")

private AlbumSuperClass beanSuperAlbum; 

相关文章:

  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-08-24
  • 2022-12-23
  • 2021-06-03
  • 2021-07-18
相关资源
相似解决方案