Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4113136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:17:06+00:00 2026-05-20T22:17:06+00:00

I am getting this error, and am wondering if anyone has any idea how

  • 0

I am getting this error, and am wondering if anyone has any idea how to debug this.

Thanks

Initializing[GL.Objects.Profile`1[[GL.Objects.Education.Education,
GL.Objects, Version=0.1.1.0,
Culture=neutral,
PublicKeyToken=ebf25c7be4be0c91]]#289289]

-failed to lazily initialize a collection of role:

GL.Objects.Profile`1[[GL.Objects.Education.Education,
GL.Objects, Version=0.1.1.0,
Culture=neutral,
PublicKeyToken=ebf25c7be4be0c91]].Profilables,

no session or session was closed”

Starts up the session

        var watsonService = new WatsonService();

This code saves the instantiated objects.

   watsonService.SaveEducation(e);
    epf1.Profilables.Add(e);
    watsonService.SaveEducationProfile(epf1);
    epf2 = watsonService.GetEducationProfile(epf1.ID.Value);

The first assert passes just fine. epf2 has an id and is instantiated.

        Assert.AreEqual(epf1.ID, epf2.ID);

This assert fails. The Profileables matches a composite table which id’s get inserted successfully. But now when I try to access the first element in the collection it fails.

        Assert.AreEqual(epf1.Profilables[0].ID, epf2.Profilables[0].ID);

This is the method implementation that get’s called by the GetEducationProfile method.

public T Get<T>(int id) where T : IDataObject
{
    return (T)_session.Load(typeof(T), id, LockMode.Read);
}

This is the definition of the constructor in the Fluent Mapping file.

public EducationProfileMap()
    {
        Table("Profile");
        Id(x => x.ID)
        .Column("ProfileID")
        .GeneratedBy
        .HiLo(FluentConst.HILO_TABLE,
              FluentConst.NEXTHI_COLUMN,
              FluentConst.MAXLO, 
              String.Format(FluentConst.WHERE_FMT_STR, "Profile"));

        Map(x => x.Type).CustomType<int>().Column("ProfileType");

        HasManyToMany(x => x.Profilables)
                    .ParentKeyColumn("ProfileID")
                    .ChildKeyColumn("EducationID")
                    .Cascade.All()
                    .Table("EducationProfile");
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:17:07+00:00Added an answer on May 20, 2026 at 10:17 pm

    My apologies for not giving more relevant information to the problem.
    The Problem comes from how the sessions are managed.

    My test is instantiating the following class :

        public WatsonAdaptor(string user)
        {
            if (DataSession == null)
             DataSession = new  HibernateSession(
                           HibernateFactoryManager.HibernateFactory.Watson, user);
        }
    

    The following method is called by the SaveEducation method

       public int? SaveEducation(Education e) {
            try
            {
                var watson = new WatsonAdaptor("ealite");
                watson.Save(e);
                return e.ID;
            }
            catch (Exception ex)
    

    Which opens a session.

    On the return the session is thrown away so lazy loading can’t happen.

    What I need to do, is to make sure the lazy loading is happening while the session is still open.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Getting this error when try to add an item to my repositories/context: Collection has
Anyone getting this error when using the new free chart controls MS bought from
I am getting this error now that I hit version number 1.256.0: Error 4
Basically I'm wondering if anyone has any tips for ensuring your code is well
I am getting an unusual error while running my application, just wondering if anyone
just wondering if anyone could suggest why I might be getting an error? I'm
Wondering if anyone has a solution to this 2010 bug. I have a project
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.