簡體   English   中英

Grails中的域類

[英]Domain classes in grails

如何在Grails中建立兩個域類之間的關系。 我已經從插件(spring security插件)中獲得了一個域類,並且我想將USER域類從插件鏈接到Profile域類。 最好的方法是什么?

有關良好的概述,請參見GORM文檔 對於我認為是一對一的關系,您可以簡單地執行以下操作:

class User {
    Profile profile
}

class Profile {
    // only needed if you need to refer to user from the Profile instance
    static belongsTo = [user:User] 
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM