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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:41:01+00:00 2026-05-25T02:41:01+00:00

I am new to Fluent NHibernate and ORM tools in general. I’m not exactly

  • 0

I am new to Fluent NHibernate and ORM tools in general. I’m not exactly sure what I should be expecting from the tool in this situation. I have Fund, Holding, and Asset tables with corresponding objects. The Fund object has a collection of Holdings and each holding has an Asset. When I save the fund I would like the subsequent holdings and assets save as well.

I seem to have that happening, however, I seem to be attempting to insert a new record into each table rather than updating the existing ones. I have unique constraints in the db so the saves are failing. Do I need to be querying the existing holdings and assets to get them to update?

I’m sure there has already been an answer for this question, but I couldn’t figure out how to search to find it.

Thanks in advance. Relevant Mappings below

public FundMap() 
{
...
HasMany(x => x._holdings)
    .Cascade.All();
}

public HoldingMap()
{
...
References(x => x._fund);
References(x => x._asset).Cascade.SaveUpdate();
...
}
  • 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-25T02:41:01+00:00Added an answer on May 25, 2026 at 2:41 am

    You don’t need to query the existing set, this is not a requirement. You could just create a new object and give it the same key of the object in the database, call SaveOrUpdate() and it will update the database.

    The reason you generally query the database is because you search on other criteria other than the key. This also grabs relational objects tied to this entity. In your case, a “Fund” that has many “Holdings”.

    For Example,
    if you had an existing Fund in the database with the key of 1 and a Holding associated with the Fund and that particular Holding had the key of 1, you could do the following

    var fund = new Fund{
       ID = 1,
       Name = "YourNewName",
       Holdings = new List<Holding>{
         new Holding{
           ID = 1
           Description = "NewHoldingDescription"
         }
       }
    }
    
    //and then perform a SaveOrUpdate() on the fund, it should update the entries in the database
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Fluent and NHibernate and I'm not sure how to map this
I'm trying to use (new with) Fluent NHibernate (trying to switch from XML mapping
I am learning Fluent NHibernate and this issue arose from that project. I have
I'm new to NHibernate and Fluent NHibernate. Assuming I have a situation like the
I am new to nHibernate. I understand how to use mapping using Fluent nHibernate.
New to javascript, but I'm sure this is easy. Unfortunately, most of the google
I am very new to Fluent NHibernate and I have a problem that I
I am brand new to NHibernate and Fluent NHibernate and I am trying to
I'm new to using NHibernate/Fluent NHibernate and am trying to figure out how to
I have this administration site that is using (Fluent) NHibernate for data access. As

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.