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

The Archive Base Latest Questions

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

I’m facing the following situation. My objectmodel is as follows: EntityA –*> EntityB ->

  • 0

I’m facing the following situation.

My objectmodel is as follows:

EntityA --*> EntityB -> EntityC

EntityA references a list of EntityB. EntityB references a single EntityC

My mapping is:

  <class name="EntityA" table="TAB_A" >
    <id name="Id" column="A_ID" >
      <generator class="native" />
    </id>
    <version name="Version" column="VERSION" />
    <bag name="listOfB" cascade="save-update" table="A_TO_C" lazy="false" >
      <key column="FK_A_ID" />

      <composite-element class="EntityB" >
        <many-to-one name="refToC" class="EntityC" column="FK_C_ID" cascade="save-update" />
      </composite-element>
    </bag>
  </class>

I left out all the extra properties and stuff.

I query the DB:

var query = session.Query<EntityA>()
                    .Where(a=> a.listOfB.Any(b => b.refToC == anInstanceOfC));

// count all matches
var count = query.ToFutureValue(t => t.Count());

Okay, that looks good for me so far ;). When I execute the query I get an error, that an SQL-Statement fails. The generated SQL contains the following sub statement:

select listOfB1_.A_ID
from A_TO_C listOfB1_
where a0_.A_ID=listOfB1_.FK_A_ID
and listOfB1_.FK_C_ID=?

The statement expects a column A_ID on table A_TO_C (which actually is the column name of the id-column of TAB_A). What it should do, is selecting the column listOfBl_.FK_A_ID wich is the foreign-key-column referencing the A_ID column of TAB_A.

Now the question: Am I wrong or is it the SQL-generator ?

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

    Actually it is a bug.

    See another thread on stackoverflow,

    my question and discussion on the nhibernate googlegroup

    and the actual bug report in the nhibernate issue tracker

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am doing a simple coin flipping experiment for class that involves flipping a
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.