我正在尝试保存具有很多关系的对象.SellingCompany可以拥有多个账户,账户可以与许多销售公司相关联.因此,存储在SellingCompaniesAccount中的表之间存在许多关系
我的Account_Info域名如下:
class AccountInfo {
static mapping ={
table 'AccountInfo'
version false
//id column:'accountInfoID'
}
String evi_pass_phrase
String evi_username
String security_key
// to make sure fields show up in a particular order
static constraints = {
//accountInfoID(insert:false,update:false)
evi_pass_phrase()
evi_username()
security_key()
}
static hasMany = [sellingcompaniesaccount:SellingCompaniesAccount]
String toString() {
return "${evi_username}"
}
}
Run Code Online (Sandbox Code Playgroud)
我的SellingComapanies域名如下:
class SellingCompanies
{
static mapping = {
table 'SellingCompanies'
version false
}
String name
//static belongsTo = AccountInfo
//static hasMany = [accounts: AccountInfo]
static hasMany = [sellingcompaniesaccount:SellingCompaniesAccount] …Run Code Online (Sandbox Code Playgroud)