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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:30:04+00:00 2026-05-30T17:30:04+00:00

I am using NHibernate for my database management. In one class I am calculating

  • 0

I am using NHibernate for my database management.
In one class I am calculating a property using this formula:

(SELECT MIN(x.timestamp) FROM (SELECT MAX(r.Timestamp) AS timestamp, r.Meter_Id FROM Reading r, Meter m WHERE r.Meter_Id = m.Id AND m.Store_Id = Id GROUP BY r.Meter_Id) AS x)

The generated query looks like this:

(SELECT MIN(x.timestamp) FROM (SELECT MAX(r.Timestamp) AS timestamp, r.Meter_Id FROM Reading r, Meter m WHERE r.Meter_Id = m.Id AND m.Store_Id = this_.Id GROUP BY r.Meter_Id) AS this_.x)

Obviously the name in the AS statement is renamed to this_.x, which causes the error.

It seems to be a known bug: NHibernate JIRA #NH-2878

Does enyone have a solution for this?

  • 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-30T17:30:05+00:00Added an answer on May 30, 2026 at 5:30 pm

    I could be mistaken, but I don’t actually see why you need the alias in that particular formula.

    In a more general sense, you have a few options:

    • Work around the issue. You could use a stored procedure, or load more data and do the calculation in-memory.
    • Fix it. NHibernate is open source — pull down the code, find the cause, isolate it in a test, fix it, and send a pull request.
    • Get someone else to fix it. If your company is using NHibernate and this is important to them, they could probably sponsor another NHibernate contributor to implement a fix.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set: <property name=hbm2ddl.auto
I'm using NHibernate to retrieve a list from the database based on some criteria.
I'm using NHibernate for a project. This project opens a SQL Server 2005 database
I'm using Fluent NHibernate auto mapping. I need to access more than one database
I have a Currency class which I persist to my database using NHibernate. Currency
I developing a paged service to retrieve data from database using NHibernate. In my
I have a class, Order, which I persist to a database using NHibernate. There
I'm using nHibernate on a webpage for viewing items from an already existing database.
I am using NHibernate to map a class to a database table. The Part
Is reading the database records from the Database using Stored Procedures in NHibernate a

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.