Grails 一对多单向不创建连接表是行不通的。我按照 here.
中提到的文档进行了尝试。当我尝试根据创建连接表的文档创建域类时。这是一个错误还是我的理解有误?这是我使用的代码
class Book {
String bookName
static hasMany = [authors: Author]
static mapping = {
authors column: 'BOOK_AUTHOR_ID'
}
}
class Author {
String authorName
static constraints = {
}
}
结果表 EER 模型是
注意: 在 application.yml 文件中使用 datasource.dbCreate 作为“create-drop”。