开发者

Gorm issue help

I have two classes

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

and

class User {
   Facebook facebook
   String fullname
}

I make a Facebook object , then make a User object and when I try to save Us开发者_开发知识库er it does not allow me to . The error comes like

Trying to marshall a null id [id] for alias [User]

Please help


You should check how to setup a one-to-one mapping with Grails GORM following this link:

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

There is an example with Face and Nose similar to User/Facebook.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜