-2
A
回答
0
創建註釋域類
class comment
{
String message;
static belongsTo=[User] //add or can leave it , for all your ten domains
}
然後,你需要將它與關聯讓利說你的域類十,ex.User
class User {
String UserName
static hasMany=[comments:Comment] // if you have many commentin one pass or
Comment comment ///just one to one relationship for every login one record
}
和bean,
您可以創建一個commentService對於剛剛在評論你的域類操作,Grails的創建DI豆你創建服務 一個commentService後自動和你可以有哪些將被注入
def registerInfo(){
//do some comment and domin related stuff
}
like in a controller login
def commentService
def signin(){
commentService.registerInfo(params)
}
相關問題
- 1. Grails:實現SSO
- 2. 如何在spring bean中實現@viewscoped
- 3. 如何在Spring中實現彈性bean?
- 4. 如何實現Singleton-like EJB3.0 bean?
- 5. 如何在Grails中實現Hibernate @Any?
- 6. 如何在Grails中實現批處理
- 7. 如何實現「SELECT SUM()」中的Grails
- 8. 如何在Grails中實現響應表?
- 9. 如何實現「bean」和「bean映射」代碼?
- 10. Grails實現關係
- 11. 如何在Grails中獲取prototype bean的實例?
- 12. Grails:如何處理JSR 303 bean驗證
- 13. 春天注入實現bean
- 14. 春後備bean實現
- 15. Java bean和方法實現
- 16. 如何在Grails應用程序中實現用戶首選項
- 17. Grails:如何處理Grails上的Java bean驗證
- 18. 如何在Grails中實現自定義深度ObjectMarshaller <JSON>?
- 19. Grails未能實現Domain類
- 20. 在grails中實現spring緩存插件
- 21. grails嵌套bean錯誤
- 22. 從Grails腳本加載bean
- 23. Grails中的Spring bean定義
- 24. 在EJB3中,如何實現Session Bean的繼承?
- 25. 如何在AWS Elastic Bean Stalk中使用PHP/Apache實現HTTPS
- 26. 如何在Java SE 1.6中實現bean驗證
- 27. 如何實現從遠程無狀態會話bean的接口?
- 28. 如何在運行時選擇bean實現在春天
- 29. 同一個bean的多重實現
- 30. Introspector getBeanInfo bean通用實現方法
如何[傳承](HTTP一些樣品服務方法://grails.org/doc/latest/guide/GORM.html#inheritanceInGORM)? –
請嘗試更詳細地編輯你的問題! – danielad