다음 코드, 내 데이터베이스에서 특정 프리젠 테이션을 받고 모델 속성으로 추가하고 상세 뷰 반환이 : 나는 '내 관점에서게으른로드 내 컨트롤러에서
@RequestMapping(value = "/detail", method = RequestMethod.GET)
public String detail(Model model, Principal principal, @RequestParam("id") int id) {
Presentation p = presentationDao.get(id);
model.addAttribute("presentation", p);
return "detail";
}
을 m 사용하여 JSTL 게으른 로딩이있는 프리젠 테이션의 속성을 표시하려고 :
$ {pressentation.student.dossiers.proposal.titel} 그러나
학생이 '위한 서류'의 목록이지만, 지연로드를 사용 중입니다 :
나는 내가 발견 봤 때Severe: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
: 나는 열망에 서류의 FetchType를 설정하면
org.apache.jasper.JasperException: javax.el.ELException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: domein.Student.dossiers, no session or session was closed
나는 심지어 내 프로젝트를 실행할 수 없습니다 :
@OneToMany(mappedBy = "student", fetch = FetchType.LAZY)
private List<Dossier> dossiers;
하지만 나는 다음과 같은 예외가 다음 해결책 :
@RequestMapping(value = "/detail", method = RequestMethod.GET)
public String detail(Model model, Principal principal, @RequestParam("id") int id) {
Presentatie p = presentatieDao.get(id);
Hibernate.initialize(p.getStudent().getDefinitiefDossier().getVoorstel().getTitel());
model.addAttribute("presentatie", p);
return "detail";
}
그러나 그것은 다시 다음 예외가 발생합니다.
당신이보기 패턴에서 열기 세션 봤어보기 인터셉터 오픈 세션을 시도? – chrylis
모델에서 FetchType을 작성하면 열심히합니다 –
fetchtype을 열심히 만들 수 없습니다. 게시물에서 말한 것과 같은 예외가 있습니다. 보기 패턴 Chrylis에서 열린 세션이란 무엇을 의미합니까? –