안녕하세요, 저는 m : mdb 관계로 GRAILS 응용 프로그램을 구축하고 있습니다. 항목을 표시하려고 할 때 "lazily 역할 모음을 초기화하지 못했습니다 ... 세션이나 세션이 닫히지 않았습니다"오류가 표시됩니다.지연 컬렉션을 지연 초기화하지 못했습니다.
한 클래스입니다 :
class Hazzard{
static hasMany = [warning:Warning]
static constraints = {
text(size:1..5000)
}
String name
String text
String toxicity
}
다른 :에서
class Warning{
static hasMany = [hazzard:Hazzard]
static belongsTo = Hazzard
static constraints = {
text(size:1..5000)
}
String code
String text
}
다른쪽으로/다음과 같은 코드가 작동 보여 좋은
<g:each in="${hazzardInstance.warning}" var="p">
<li><g:link controller="Warning" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
</g:each>
하지만, 다음과 같은 코드가 제공됩니다 다른 페이지에
오류 :<g:set var="haz" value="${Hazzard.get(params.id)}" />
<h1>${haz.name}</h1>
<p>${haz.text}</p>
<h1>Toxiciteit</h1>
<p>${haz.toxicity}</p>
<br/>
<h1>Gevaren(H) en voorzorgen(P)</h1>
<g:each in="${haz.warning}" var="p"> --> This is where the error pops-up
${p.text}
</g:each>
이것이 실패한 곳의 단서가 있습니까?
어떤 Grails 버전을 사용하고 있습니까? –
GRAILS 버전을 사용하고 있습니다 : 1.3.6 – BadSkillz