如何为多个表生成图表

时间:2014-10-13 15:20:07

标签: sql database class entity-relationship diagram

我有4个实体基金,成分,工具,现金 我想设计一个模型,其中一个组合可能是基金或工具或现金

表:

基金(id_pk,名称)

组成(id_pk,单位和fk id到其他表格(资金,工具,现金)

仪器(id_pk,姓名,MATURITY_DATE) 现金(id_pk,名称,货币)

我该如何设计???

@Entity
public  class Fund implements Serializable {


    @OneToMany(targetEntity=Composition.class)
    private Collection<Composition> composition1;
    public Fund(){
    }

   public Collection<Composition> getComposition1() {
        return this.composition1;
    }


  public void setComposition1 (Collection<Composition> composition1) {
        this.composition1 = composition1;
    }

@Entity
public  class Instrument implements Serializable {

    public Instrument(){

    }
}
@Entity
public  class Cash implements Serializable {

    public Cash(){

    }
}

@Entity
public  class Composition implements Serializable {


    @OneToOne(targetEntity=Fund.class)--????
    private Object position --here is my problem . may be Fund, Cash or Instrument

    public Composition(){

    }

}

0 个答案:

没有答案