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

  • Home
  • SEARCH
  • 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 146553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:37:25+00:00 2026-05-11T08:37:25+00:00

I’m working with a legacy system that I’m experimenting with adding NHibernate to. I

  • 0

I’m working with a legacy system that I’m experimenting with adding NHibernate to. I have class that I need to be mapped to a table, but it has lots of existing methods that are not virtual.

I discovered that I can get NHibernate to load the mapping successfully even with the non-virtual methods present if I set the ‘lazy’ attribute on the class element of the mapping file to ‘false’. I’m wondering what impact this will have on my use of NHibernate with this class.

I understand the meaning of non-lazy loading on collections that belong to an object, but I’m not clear on the meaning of what lazy or eager loading on a class would be. Does that mean all collections belonging to that object would be eager-loaded? Or does it mean that NHibernate no longer uses a dynamic proxy in place of the actual class? Something else?

Also, what’s the best course of action here? Is setting that lazy=false value inadvisable? Should I create an interface that the class implements, and then map that to the table? Or should I just bite the bullet and mark all the existing methods on the class virtual?

Thanks in advance for any and all advice!

  • 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. 2026-05-11T08:37:26+00:00Added an answer on May 11, 2026 at 8:37 am

    I always specify lazy=false on the class level in NHIbernate, because I do not want that NHibernate forces me to declare that properties are to be virtual, if I do not want this in my class-model.

    When you specify ‘lazy’ at the class mapping (default), NHibernate uses a ‘Dynamic Proxy’ class at runtime. This Dynamic Proxy is a class that inherits from your class. Then, as far as I understand, the instance of the class should be initialized lazily / on-demand. In some cases, this should be better for performance (at least, that’s what’s being told).

    But, since I do not like that NHibernate tells me how my class should look like, I’ve always specified lazy=false for all my classes, and I haven’t ran into trouble yet. 🙂

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.