我有以下 2 个域类
class Foo implements Serializable {
Long fooId1
Long fooId2
Long hFooId1
Long hFooId2
Foo hFoo
Bar bar
static mapping = {
datasources(['ds1','ds2'])
id composite: ["fooId1", "fooId2"]
version false
columns {
bar(insertable: false, updateable: false) {
column name: 'fooId1'
column name: 'fooId2'
}
hFoo(insertable: false, updateable: false) {
column name: 'hFooId1'
column name: 'hFooId2'
}
}
}
static constraints = {
hFooId1 nullable: true
hFooId2 nullable: true
bar nullable: true
hFoo nullable: true
}
}
class Bar implements Serializable
{
Long fooId1
Long fooId2
Foo foo
static mapping = {
datasources(['ds1','ds2'])
id composite: ["fooId1", "fooId2"]
version false
cache include: 'non-lazy'
foo(insertable: false, updateable: false) {
column name: 'fooId1'
column name: 'fooId2'
}
}
}
通过集成测试...
@Integration
@Rollback
@Mock([Foo, Bar])
....
def "Simple Test"(){
expect:
def bar = Bar.build( fooId1: 1, fooId2: 2)
def hFoo = Foo.build( fooId1: 1, fooId2: 2, bar: bar)
def foo = Foo.build( fooId1: 123, fooId2: 456, hFoo: hFoo)
foo.fooId2 == 456
foo.hFoo.fooId2 == 2
foo.bar == null
foo.hFoo.bar.fooId2 == 2
}
我明白了
不能在 org.grails.orm.hibernate.cfg.PropertyConfig.getScale(PropertyConfig.时髦:198)
这是一个升级,所以它似乎在 Grails 2-
谁能看到我错过了什么?