-->
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.  [ 3 posts ] 
Author Message
 Post subject: Failed to lazily initialize a collection - no session
PostPosted: Wed May 21, 2008 4:14 pm 
Newbie

Joined: Wed May 21, 2008 4:09 pm
Posts: 2
Location: wisconsin
Hi. I'm getting the error message Failed to lazily initialize a collection - no session on the bolded code line shown below. The error appears to be common, as I see many posts out there. But none of them thusfar have helped me solve the problem. Can someone please direct me how to fix the error message? Thanks!

[code]public IList<Meeting> MyEmployeesMeetings
{
get
{
IList<Meeting> oMeetings = new List<Meeting>();

//Get employee meetings
foreach (User oEmployee in _employees)
{
[b]foreach (Meeting oMeeting in oEmployee.Meetings)[/b]
{
oMeetings.Add(oMeeting);
}
}

//Get this instance's meetings
foreach (Meeting oMeeting in _meetings)
{
oMeetings.Add(oMeeting);
}

return oMeetings;
}
}[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 22, 2008 12:41 am 
Newbie

Joined: Wed May 21, 2008 7:24 pm
Posts: 2
Make sure the session that _employees and _meetings was loaded is not closed.

I can not tell you much more without seeing your mapping files and the code that loads those objects from nhibernate.


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Thu May 22, 2008 9:22 am 
Newbie

Joined: Wed May 21, 2008 4:09 pm
Posts: 2
Location: wisconsin
Could you tell me what those mapping files look like, or where I may find them? I know this is a very sophomoric question, but I am completely new to NHibernate and am trying to just get this one thing working for the time being. If you could point me in the right direction as to where I should look for these files, I'd appreciate it.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.