gpt4 book ai didi

grails - Gorm 问题帮助

转载 作者:行者123 更新时间:2023-12-02 15:14:17 26 4
gpt4 key购买 nike

我有两个类

class Facebook {
String fid
String name
User user
static constraints = {
user(nullable:false)
}
}


class User {
Facebook facebook
String fullname
}

我制作了一个 Facebook 对象,然后制作了一个用户对象,当我尝试保存用户时它没有
请允许我 。错误就像
Trying to marshall a null id [id] for alias [User]

请帮忙

最佳答案

您应该通过以下链接检查如何使用 Grails GORM 设置一对一映射:

http://grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.2.1.1 Many-to-one and one-to-one

有一个类似于 User/Facebook 的 Face and Nose 示例。

关于grails - Gorm 问题帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6706907/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com