zoukankan      html  css  js  c++  java
  • SpringMVC 中实体类父子类关系设置

     父类:
    
    @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; 
    

  • 相关阅读:
    快速选择算法
    归并排序求逆序对
    学习记录:Dijstra最短路
    学习记录:拓扑排序
    学习记录:最小生成树
    学习记录:线段树
    STL:unqiue
    击中心头那些字
    javaWeb项目结构
    java注解
  • 原文地址:https://www.cnblogs.com/live365wang/p/2001071.html
Copyright © 2011-2022 走看看