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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:11:23+00:00 2026-05-17T16:11:23+00:00

Ayende has a great example of using the <any> mapping here , which I

  • 0

Ayende has a great example of using the <any> mapping here, which I am reposting as part of my question since comments are closed on that blog post. Given his original mapping:

<class name="Order" table="Orders">

    <id name="Id">
        <generator class="native"/>
    </id>

    <any name="Payment" id-type="System.Int64" meta-type="System.String" cascade="all">
        <meta-value value="CreditCard" class="CreditCardPayment"/>
        <meta-value value="Wire" class="WirePayment"/>
        <column name="PaymentType"/>
        <column name="PaymentId"/>
    </any>

</class>

<class name="CreditCardPayment" table="CreditCardPayments">
    <id name="Id">
        <generator class="native"/>
    </id>
    <property name="IsSuccessful"/>
    <property name="Amount"/>
    <property name="CardNumber"/>
</class>

<class name="WirePayment" table="WirePayments">
    <id name="Id">
        <generator class="native"/>
    </id>
    <property name="IsSuccessful"/>
    <property name="Amount"/>
    <property name="BankAccountNumber"/>
</class>

… how would I go about mapping a property named Order on the CreditCardPayment and WirePayment classes which would be the “flip side” of the association allowing traversal from these payments back up to the Order they are associated with?

The gotcha for me here is that CreditCardPayment and WirePayment can potentially have the same IDs since they are in different tables, so I need some way to tell NHibernate to take the PaymentType into consideration.

  • 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-17T16:11:24+00:00Added an answer on May 17, 2026 at 4:11 pm

    Bidirectional heterogeneous associations (i.e. <any>) are not supported by NHibernate.

    I know this isn’t what you wanted to hear, but that’s it.

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

Sidebar

Related Questions

I'm trying to evaluate NHibernate.LINQ 1.0 without actually writing any code. Ayende has admitted
I was reading the example chapter from the book by Ayende and on the
I found what I thought was a great article by Ayende on creating a
The comments section of this article: http://ayende.com/Blog/archive/2010/09/18/resolving-cross-site-scripting-issues.aspx has a very interesting comment. In it,
I have a collection mapped as a query only property following Ayende's example .
I recently read Ayende's blog post on automatic registration working with XML Configuration. I
A couple of days ago, I read a blog entry ( http://ayende.com/Blog/archive/2008/09/08/Implementing-generic-natural-language-DSL.aspx ) where
Foo has Title. Bar references Foo. I have a collection with Bars. I need
Has anyone been able to get an NHibernate-based project up and running on a
I'm writing an NHibernate criteria that selects data supporting paging. I'm using the COUNT(*)

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.