无法延迟初始化角色集合:com.hypatech.domain.Branch.todos

时间:2020-03-08 10:11:44

标签: groovy gorm micronaut micronaut-data

嗨,我在Micronaut上使用GORM,并且我有两个具有关系的类,并试图获取该分支下列出的Todos列表的Branch,但是我收到了延迟初始化的错误。以下是两个类:

import grails.gorm.annotation.Entity

@Entity
class Branch {
    String name
    static  hasMany = [todos: Todo]
}
import grails.gorm.annotation.Entity

@Entity
class Todo {
    Long id
    String title
    String description
    Boolean isCompleted = false

    static belongsTo = [branch: Branch]

    static constraints = {
        id unique: true
        title nullable: false, unique: true
        description nullable: false
        isCompleted nullable: false
    }

    static mapping = {
        autoTimeStamp true
        table "todo"
    }
}```

Help? what am I missing?

0 个答案:

没有答案