代码之家  ›  专栏  ›  技术社区  ›  Visionary Software Solutions

Grails GORM组合还是hasOne?

  •  14
  • Visionary Software Solutions  · 技术社区  · 16 年前

    对于使用静态hasOne映射和在域类中组合对象之间的区别,我有点困惑。两者之间有什么区别?即。

    class DegreeProgram {
    
    String degreeName
    Date programOfStudyApproval
    static hasOne = [committee:GraduateCommittee]
    }
    

    class DegreeProgram {
    
    String degreeName
    Date programOfStudyApproval
    GraduateCommittee committee
    }
    

    其中,GraduateCommittee是另一个GORM领域模型类。

    1 回复  |  直到 16 年前
        1
  •  10
  •   Jean Barmash    16 年前
    推荐文章