我有以下情况与一个“坏的老”'遗产数据库:
class FktDef {
static belongsTo = [fktArt: FktArt] // FktArt has a composite primary key
String fktBez
static mapping = {
column {
fktArt {
column name: 'fkt_art'
column name: 'fkt_art_lfd'
}
}
}
}
到目前为止......
但是现在我的规范对[fktArt和fktBez]有一个独特的约束
如果我定义以下内容:
static constraints = {
fktArt: unique: ['fktBez']
}
我得到2个约束,一个用[fkt_bez,fkt_art],另一个用[fkt_bez,fkt_art_lfd],但我的目标应该是[fkt_bez,fkt_art,fkt_art_lfd]
的约束有没有办法达到规格?我尝试了几件事,但都抛出了一个db-error ......
我另外尝试过:
fktArt: unique: ['fktArt', 'fktBez'] ...
fktArt: unique: ['fktArt.fktArt', 'fktArt.fktArtLfd', 'fktBez'] ...
fktBez: unique: ['fktArt'] etc.
但到目前为止没有任何作用......