These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Unexpected row count: 0; expected: 1
PostPosted: Tue Sep 07, 2010 6:20 am 
Newbie

Joined: Wed Aug 25, 2010 12:52 pm
Posts: 12
Hi guys!

I currently get the exception in the topic. I still started with NHibernate and my application is still very easy, but I just can't fix the bug. Hopefully you can help me. It's a one-to-one relationship.

Attributs of Geo.cs:
Code:
public class Geo
    {
        private int id;
        private string city;
        private string accessory;
        private Coordinates coordinates;
        private int areaCode;
        private string federalState;
    }


Attributes of Coordinates.cs:
Code:
    {
        private int plc;
        private double longitude;
        private double latitude;
    }


Now the mapping-files...
Geo:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="GeoApplication"
                   namespace="GeoApplication.Domain"
                   default-access="property">
 
  <class name="Geo" table="geo_table">
    <id name="Id" column="id" type="Int32">
      <generator class="increment">
        <param name ="property">Coordinates</param>
      </generator>
    </id>
    <property name="City" column="city" length="40" not-null="true"/> <!-- length rein !-->
    <property name="Accessory" column ="accessory" length="40" not-null="false"/>
    <property name="AreaCode" column="area_code" length="8" not-null="false"/>
    <property name="FederalState" column="federal_state" length="30" not-null="true"/>

    <one-to-one name="Coordinates" class="Coordinates"/>
  </class>


Coordinates:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="GeoApplication"
                   namespace="GeoApplication.Domain"
                   default-access="property">

  <class name="Coordinates" table="plc_coordinates_table">
    <id name="Plc" column="plc" type="Int32" length="5">
      <generator class="identity"/>
    </id>
    <property name="Longitude" column="longitude"/>
    <property name="Latitude" column="latitude"/>
  </class>
</hibernate-mapping>


The error appears when I commit the transaction.
Has anybody an idea?

Regards, Joey


Top
 Profile  
 
 Post subject: Re: Unexpected row count: 0; expected: 1
PostPosted: Tue Sep 07, 2010 8:39 am 
Newbie

Joined: Wed Aug 25, 2010 12:52 pm
Posts: 12
I found the bug. I used the SaveOrUpdate() before. But if I use the Save() method it works!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.