嗨,我在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?