Grails Domain:CompositeIdentity CannotRedirectException它不是域或没有标识符

时间:2016-06-01 09:36:11

标签: hibernate grails groovy

我的课程定义如下:

class A{
    String id
    static hasMany = [b: B]
}
class B  implements Serializable {
    A a1
    A a2
    static belongsTo = [a1: A, a2: A]
    static hasMany = [a1: A, a2: A]
    static mapping = {
        id composite: ['a1','a2']
    }

    equals and hashCode method...
}

但是当我运行它(Controller def scaffold = true)时,它说:没有这样的属性:类的生成器:org.codehaus.groovy.grails.orm.hibernate.cfg.CompositeIdentity

然后我手动生成Controller和视图的代码,错误更改为: 类 org.codehaus.groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException 信息 无法重定向对象[B :(未保存)]它不是域或没有标识符。请改用显式重定向

最后我找到了explicit redirect

问题解决了。

结论:插件脚手架不支持复合键。

0 个答案:

没有答案
相关问题