Grails get child domain objects

前端 未结 4 746
陌清茗
陌清茗 2020-12-01 04:40

I have two domain classes one is parent and other one is child and i have a hasMany relationship between them. Parent class has many childs and child class belongs to parent

4条回答
  •  时光说笑
    2020-12-01 05:04

    The latest grails automatically deep converts but you are probably a victim of lazy loading.

    The children are not loaded at access and hence the JSON converter cannot convert them to JSON. The workaround is to put this

    static mapping = { childs lazy: false }

提交回复
热议问题