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 6799729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:52:59+00:00 2026-05-26T18:52:59+00:00

I decided to learn how to use an ORM to avoid learning some SQL

  • 0

I decided to learn how to use an ORM to avoid learning some SQL (mistake — only approach would be to go no-SQL).

I have been able to get the Nhibernate “SQL” using Log4Net, using the instructions that are duplicated in quite a few blogs. I get “SQL” like this:

NHibernate.Loader.Loader: 2011-11-11 15:03:14,348 [9] INFO  NHibernate.Loader.Loader [(null)] - SELECT this_.RegionID as RegionID9_0_, this_.RegionDescription as RegionDe2_9_0_ FROM Region this_

Now correct me if I am wrong but that is not SQL, and I can’t understand why all of these blogs talk like it is.

The strange thing is that earlier when I was messing around with log4net, I am sure that I was able to get ordinary SQL logged to a logfile. When I basically did getall() of an entity (read a whole table), all of the individual queries were listed there with the id in the query -one for each row(entity). I definitely didn’t imagine this. Can anyone tell me how this is done with log4net? Here is my config right now:

<log4net>
<appender name="DebugSQL" type="log4net.Appender.TraceAppender">
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
  </layout>
</appender>

<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
  <param name="File" value="log.txt"/>
  <param name="AppendToFile" value="true"/>
  <param name="DatePattern" value="yyyy.MM.dd"/>
  <layout type="log4net.Layout.PatternLayout,log4net">
          <conversionpattern value="%d %p %m%n">
          </conversionpattern>
    </layout>
  </appender>

<logger name="NHibernate.Loader.Loader" additivity="false">
  <level value="All"/>
  <appender-ref ref="DebugSQL" />
</logger>

Edit: I now know that it was sql, and I couldn’t reproduce the emitted sql that I had seen earlier because lazyloading was on before:

NHibernate.SQL: SELECT region_.RegionDescription as RegionDe2_9_ FROM Region region_ WHERE region_.RegionID=@p0;@p0 = 1 [Type: Int32 (0)]
NHibernate.SQL: SELECT region_.RegionDescription as RegionDe2_9_ FROM Region region_ WHERE region_.RegionID=@p0;@p0 = 2 [Type: Int32 (0)]
NHibernate.SQL: SELECT region_.RegionDescription as RegionDe2_9_ FROM Region region_ WHERE region_.RegionID=@p0;@p0 = 3 [Type: Int32 (0)]
NHibernate.SQL: SELECT region_.RegionDescription as RegionDe2_9_ FROM Region region_ WHERE region_.RegionID=@p0;@p0 = 4 [Type: Int32 (0)]
  • 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-26T18:53:00+00:00Added an answer on May 26, 2026 at 6:53 pm

    What you see after the dash in the log is indeed SQL. It is syntactically and semantically correct, but it just looks plain ugly. This is commonplace when SQL is not written manually: code generators use names such as RegionID9_0_ for disambiguation, making the output look unusual to a human reader.

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

Sidebar

Related Questions

Greetings, everyone. I'm trying to learn some Silverlight basics, and have decided to write
I've decided to learn prolog. What's a good interpreter to use? Even better if
I decided to learn C++ (I program in C at work), and I have
I've recently decided that I just have to finally learn C/C++, and there is
I have a simple SQLite database I use to track invoices. I recently decided
I am updating a web application and have decided to use SubSonic as it
I've heard ImageMagick is quite powerful, so I decided I'd learn how to use
I am trying to learn how to use tables, I have my app which
I was trying to learn how JNA works, so I decided to use the
I was trying to learn how JNA works, so I decided to use the

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.