Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. NHibernate

NHibernate

Scheduled Pinned Locked Moved C#
helpdatabasetutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Puneet Bhatnagar
    wrote on last edited by
    #1

    Hi, I am using NHibernate to persist my objects. To delete an object from DB I have written the below code : public void Delete(T item) { try { using (ISession session = factory.OpenSession()) { using (session.BeginTransaction()) { session.Delete(item); session.Transaction.Commit(); //Code is breaking here. } } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); System.Windows.Forms.MessageBox.Show(e.StackTrace); } } The code is breaking at line session.transaction.commit(); with following error message "Unexpected row count: 0; expected: 1" Please let me know how to fix this. Thanks in Advance Regards Puneet

    L H M 3 Replies Last reply
    0
    • P Puneet Bhatnagar

      Hi, I am using NHibernate to persist my objects. To delete an object from DB I have written the below code : public void Delete(T item) { try { using (ISession session = factory.OpenSession()) { using (session.BeginTransaction()) { session.Delete(item); session.Transaction.Commit(); //Code is breaking here. } } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); System.Windows.Forms.MessageBox.Show(e.StackTrace); } } The code is breaking at line session.transaction.commit(); with following error message "Unexpected row count: 0; expected: 1" Please let me know how to fix this. Thanks in Advance Regards Puneet

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      I cant recall what I did to fix this, but this the reason I do not use NHibernate.

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)
      ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

      1 Reply Last reply
      0
      • P Puneet Bhatnagar

        Hi, I am using NHibernate to persist my objects. To delete an object from DB I have written the below code : public void Delete(T item) { try { using (ISession session = factory.OpenSession()) { using (session.BeginTransaction()) { session.Delete(item); session.Transaction.Commit(); //Code is breaking here. } } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); System.Windows.Forms.MessageBox.Show(e.StackTrace); } } The code is breaking at line session.transaction.commit(); with following error message "Unexpected row count: 0; expected: 1" Please let me know how to fix this. Thanks in Advance Regards Puneet

        H Offline
        H Offline
        Harvey Saayman
        wrote on last edited by
        #3

        With a user name like that i bet you get a shit load of spam :rolleyes:

        Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

        1 Reply Last reply
        0
        • P Puneet Bhatnagar

          Hi, I am using NHibernate to persist my objects. To delete an object from DB I have written the below code : public void Delete(T item) { try { using (ISession session = factory.OpenSession()) { using (session.BeginTransaction()) { session.Delete(item); session.Transaction.Commit(); //Code is breaking here. } } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); System.Windows.Forms.MessageBox.Show(e.StackTrace); } } The code is breaking at line session.transaction.commit(); with following error message "Unexpected row count: 0; expected: 1" Please let me know how to fix this. Thanks in Advance Regards Puneet

          M Offline
          M Offline
          Mark Churchill
          wrote on last edited by
          #4

          Are you sure the record exists?

          Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
          Alpha release: Entanglar: Transparant multiplayer framework for .Net games.

          P 1 Reply Last reply
          0
          • M Mark Churchill

            Are you sure the record exists?

            Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
            Alpha release: Entanglar: Transparant multiplayer framework for .Net games.

            P Offline
            P Offline
            Puneet Bhatnagar
            wrote on last edited by
            #5

            Ya Record is there. Could you please let me know where I am going wrong. Thanks for your efforts.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups