我想知道是否可以创建一个 grails 域对象,但它只在命令上持续存在,而不是在我们对其进行操作时。
更准确地说,这是我现在必须做的:
Foo foo = new Foo(name:"asdf")
Bar bar = new Bar(name:"gzxj")
bar.save() // persist here
foo.save() // persist here
foo.addToBars(bar) // now I have to build the relationship
我想要的是:
Foo foo = new Foo(name:"asdf")
Bar bar = new Bar(name:"gzxj")
foo.addToBars(bar) // just build the relationship
bar.save() // would be great to ignore this step
foo.save() // can I now atomically build both objects and create the relationships?
我的印象是,如果有很多关系要关联,后者会快得多。我真的只是想要 NoSQL 吗?