-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: using FetchMode.JOIN to get around lazy loading
PostPosted: Mon Apr 06, 2009 8:03 pm 
Newbie

Joined: Fri Apr 03, 2009 6:16 pm
Posts: 1
I want to use FetchMode.JOIN to get around lazy loading. I have an application which displays a list of students. Once a student is selected, I need to provide details for this student. This is when I get the lazy loading errors. The students are structured like this.

The student object contains a list of enrollments objects. The enrollment object contains a course object. The course object contains a list of sessions and a list of homework assignments... etc.

I looked through a number of postings on this forum and it looks like I can get around lazy loading by setting the fetchmode.

Criteria newCriteria = session.createCriteria(Student.class);
newCriteria.setFetchMode("enrollments", FetchMode.JOIN);

This does seem to work but only to the enrollment level. When I try to get to the course object which is within enrollment, it doesn't seem to work. I'm trying to do it like this.

newCriteria.setFetchMode("enrollments.course", FetchMode.JOIN);

How should I get to the course object?

Any help will be greatly appreciated.

Henry


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 07, 2009 12:25 am 
Regular
Regular

Joined: Thu Sep 06, 2007 2:22 am
Posts: 108
Location: Noida,India
Could you please post the sample code ( with xml mapping/annotation) and code where are you getting problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.