findOrCreateBy
を使用してオブジェクトを検索したり、一致するオブジェクトが見つからない場合はインスタンス化したりしようとしていますが、期待どおりに機能しません。
これは私が持っているものです:
String myBaz = "some unique string"
FooType myFooType = FooType.findByName("Large")
// The Foo table is empty, so this should give me a new Foo
Foo myFoo = Foo.findOrCreateByBazAndFooType(myBaz, myFooType)
assert myFoo.baz == myBaz
assert myFoo.fooType == myFooType // Fails because myFoo.fooType is null,
// but should be set to myFooType
私は何を間違っていますか?fooType
が正しく設定されていないのはなぜですか? これは予期された動作ですか、それとも Grails のバグですか?