Tree structure in GORM (grails)

I'm trying to define a tree structure in GORM. Here is my model: class Tree { String name Level rootLevel static hasOne = [rootLevel: Level] static hasMany = [levels: Level] static mappedBy = [levels:"parentTree"] } class Level { String name Tree parentTree Level parentLevel Set subLevels static belongsTo = [parentTree: Tree] static hasMany = [subLevels: Level] } Insertion seems to work fine, but when I can't load a Tree with many levels and sublevels. I guess I missed something in the relations: - the Tree should have a reference to the rootLevel (and optionally to all sublevels) - a Level should have a reference to its parent level, its sublevels and the global parent Tree Could you point me out the right direction to get a tree structure like this ? Thanks

以上就是Tree structure in GORM (grails)的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准