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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:54:36+00:00 2026-05-18T06:54:36+00:00

I have a mapping that looks like this: <class name=Record> <map name=Values> <key column=RecordFK/>

  • 0

I have a mapping that looks like this:

  <class name="Record">
    <map name="Values">
      <key column="RecordFK"/>
      <index column="FieldFK"/>
      <element column="Value"/>
    </map>
  </class>

Translating this to English: a Record maps Fields to Values. In HQL, I can query this map, as follows:

from Record rec where rec.Values[:fieldFK] = :value

Is it possible to recreate this query using the new Linq provider in NHibernate 3.0 instead of HQL? I tried the following code without success:

   var records = session.Query<Record>()
                    .Where(rec => rec.Values[field.Key] == "foo");

This produced an error when NHibernate tried to interpret the dictionary accessor:

System.NotSupportedException:
System.String get_Item(System.Int32)

Is there some way to “teach” NHibernate how to turn this C# expression into SQL?

  • 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-18T06:54:37+00:00Added an answer on May 18, 2026 at 6:54 am

    NHibernate 3 does have a way to extend the provider to allow more expressions, check http://fabiomaulo.blogspot.com/2010/07/nhibernate-linq-provider-extension.html

    However, this looks like something that should be supported. My suggestion is that you create a ticket at http://jira.nhforge.org with a failing test case.

    If you’re feeling like doing a little bit more, you can dive into https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/NHibernate/Linq and create a patch. That will make things faster.

    Update (2010-12-04): My patch has been merged into the trunk. This scenario is now supported (you can compile from source, or wait a few days for the final release)

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

Sidebar

Related Questions

I have a hibernate mapping as follows: <hibernate-mapping> <class name=kochman.elie.data.types.InvoiceTVO table=INVOICE> <id name=id column=ID>
I have a relation mapping table like this: attributeid bigint productid bigint To clean
Using NHibernate.Mapping.Attributes, I have a entity class with something like: [Class] public class EntityA
I have a mapping application that needs to draw a path, and then display
NHibernate is driving me 'Nuts'!!! I have the following mapping. Which returns this error
In C# I have a use case where I have a mapping from int
I have the following Hibernate Mapping, which has to be mapped using the Table
Object-relational mapping has been well discussed, including on here. I have experience with a
I'm considering using Annotations to define my Hibernate mappings but have run into a
Have just started using Google Chrome , and noticed in parts of our site,

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.