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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:25:47+00:00 2026-06-03T18:25:47+00:00

I hav a table with following fields public class ActivationCode { public virtual int

  • 0

I hav a table with following fields

  public class ActivationCode
{
  public virtual int LoginAccountId { get; set; }
   public virtual string ActivatedCode { get; set; }
   public virtual DateTime ActivationDate { get; set; }
}

where LoginAccountid is my primary key and mapped as

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

While saving i am assigning LoginAccountId as my users account id
bt while saving it is taking its own id and saving the data
i tried to save the data with both
Session.Save(); and Session.SaveorUpdate
bt in Session.SaveorUpdate its giving me error as

    Unexpected row count: 0; expected: 1.

Can any one help me with 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-06-03T18:25:52+00:00Added an answer on June 3, 2026 at 6:25 pm

    From nhibernate.info:

    5.1.5.7. Assigned Identifiers

    If you want the application to assign identifiers (as opposed to
    having NHibernate generate them), you may use the assigned generator.
    This special generator will use the identifier value already assigned
    to the object’s identifier property. Be very careful when using this
    feature to assign keys with business meaning (almost always a terrible
    design decision).

    Due to its inherent nature, entities that use this generator cannot be
    saved via the ISession’s SaveOrUpdate() method. Instead you have to
    explicitly specify to NHibernate if the object should be saved or
    updated by calling either the Save() or Update() method of the
    ISession.

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

Sidebar

Related Questions

I hav a table with several fields. One field is date_assigned and the other
Hav a option to set background image or color to cell. How can I
How can i get the nth row position from table without using limit ?
I hav two stl maps like map<int,int> and i want to compare them.. so
I hav been going over some old hw assignments from a class last semester.
I hav a model called User ( table: users ). I hav populated the
I hav especific need of removing word from string, But I am having problem
i hav String date & i want to inceament date by 1 & it
If I have a table in MySQL which represents a base class, and I
I have this xPath expression that I'm putting into htmlCleaner: //table[@class='StandardTable']/tbody/tr[position()>1]/td[2]/a/img Now, my issue

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.