locked
How does Nhibernate know when to insert or update a row ? RRS feed

  • Question

  • User1253338400 posted

    Hi ,

    I save some data to a sql tabel using nhibernate. Now if i click on save a second time it saves  the data to a new line so i have 2 lines instead of updating the existing. 

    Do i need to creata  primary key on the Id that Nhibernate creates as well as all other columns ?

    thanks

    Friday, October 11, 2019 6:41 AM

Answers

  • User1120430333 posted

    Hi ,

    I save some data to a sql tabel using nhibernate. Now if i click on save a second time it saves  the data to a new line so i have 2 lines instead of updating the existing. 

    Do i need to creata  primary key on the Id that Nhibernate creates as well as all other columns ?

    thanks

    Maybe, a tutorial would be helpful.

    https://www.tutorialspoint.com/nhibernate/nhibernate_basic_crud_operations.htm

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 11, 2019 9:13 AM