domain 用jointable 设置外键 一直是默认的ID 不能自定义,我用的是Grails API ,Domain 如下:
class SatisfyForMer {
String qTitle
int qType
static hasMany = [questions: Questions]
static constraints = {
}
static mapping ={
// version false
// id generator:"sequence" ,column:"sid",params:[sequence:"seq_faq"]
id generator:"identity" ,column:"sid"
table "mer_satisfy"
questions joinTable: [column: 'qType']
}
}
红色部分是我要设置的外键,但是grails 一直用默认这个类的ID,questions joinTable: [column: 'qType'] 在这里没起作用啊。帮忙看看,大侠们
本文探讨了在Grails框架中如何为domain类设置自定义的外键而非使用默认ID的问题。具体案例涉及通过joinTable配置实现特定字段作为外键关联。
1043

被折叠的 条评论
为什么被折叠?



