0
.save()
에 푸 개체하려고 할 때 Grails의 코드는 아래의 다음과 같은 예외가 발생합니다 :Grails는 GORM 문제 : 개체가 저장되지 않은 transient 인스턴스를 참조
org.hibernate.TransientObjectException/
org.springframework.dao.InvalidDataAccessApiUsageException:
object references an unsaved transient instance -
save the transient instance before flushing: Bar
내가있는 GORM 의미의 일부를 잃어 버릴 것 같아를 HTTP 매개 변수에서 자동으로 도메인 객체를 채우는 연결
내 질문은 간단하다 :
푸 개체를 채우고 저장하는 올바른 방법은 무엇- , 예외 말했다받지 않고?
모델 :
class Foo {
Bar bar
}
보기 :
<g:form id="${foo.id}">
<g:select name="foo.bar.id" from="${Bar.list()}" />
</g:form>
컨트롤러 : '바'에만 푸의 상황에있는 경우
class FooController {
def fooAction = {
Foo foo = new Foo(params)
foo.save()
[ foo: foo ]
}
}