0

给定以下域类,可以author从对象中获取 's ID的值,Book而无需像这样获取相关Author对象:(Book.get(1).authorId请参阅此 SO 问题)。

class Author {
    hasMany = [books: Book]
}

class Book {
    belongsTo = [author: Author]
}

但是,添加books ignoreNotFound:trueBook static mapping(以解决一些遗留问题)会Book.get(1).authorId导致null.

当表中缺少相关记录时,有没有办法获取表中AUTHOR_ID列的值?BOOKAUTHOR

4

0 回答 0