Google app engine 持久化对象列表

Google app engine 持久化对象列表,google-app-engine,grails,jdo,Google App Engine,Grails,Jdo,我知道了 “javax.jdo.JDOFatalUserException:don.Comment.id的元数据中出错:不能有java.lang.String主键且不能是子对象(拥有字段为don.Post.comments)。 嵌套的工作流表:“ 运行我的grails+应用程序引擎webapp时 我怎样才能解决这个问题 class Comment.groovy import javax.jdo.annotations.*; @PersistenceCapable(identityType =

我知道了 “javax.jdo.JDOFatalUserException:don.Comment.id的元数据中出错:不能有java.lang.String主键且不能是子对象(拥有字段为don.Post.comments)。 嵌套的工作流表:“

运行我的grails+应用程序引擎webapp时

我怎样才能解决这个问题

class Comment.groovy

import javax.jdo.annotations.*;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
class Comment implements Serializable {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
String id

@Persistent(mappedBy="comments")
Post post

@Persistent
String name

@Persistent
String email

@Persistent
String url

static constraints = {
    id( visible:false)
}
}

class Post.groovy
    @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
    class Post implements Serializable {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Long id

@Persistent
String title

@Persistent 
String content

//static hasMany = [comments:Comment]

@Persistent(defaultFetchGroup = "true")
Comment comments

static constraints = {
    id( visible:false)
}
}

对于子类,主键必须是com.google.appengine.api.datastore.key值(或编码为字符串),请参阅