2010-01-14 67 views
0

我收到了這個 「javax.jdo.JDOFatalUserException:元數據中的錯誤don.Comment.id:不能有一個java.lang.String主鍵並且是一個子對象(擁有字段是don.Post.comments) NestedThrowables:」Persist對象列表

運行我的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) 
} 
} 

回答