czuroski
czuroski

Reputation: 4332

nhibernate returning one repeating row

I am using nhibernate with a mysql db. I am trying to do a simple data extraction from one table. I created my entity and my mappings. I am able to talk to the db. It is pulling the correct number of rows from the db table, but each row is a duplicate of the first row in the table. (I have 51 rows in the table. 51 rows are being returned, but each row is a duplicate). I have it set to show sql, and the sql is correct.

Here is a snippet of my mapping file -

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="myAssembly" namespace="MyProject.Models.Entities">
  <class name="myClass">
    <id name="id">
      <generator class="identity" />
    </id>

    <property name="column2" />
    <property name="column3" />
....

Does anyone have any idea what might be going on? Thanks for any thoughts.

Upvotes: 1

Views: 413

Answers (1)

Diego Mijelshon
Diego Mijelshon

Reputation: 52735

Is "id" really the id of your entity?

NHibernate will return the same object for all returned rows with that id.

Upvotes: 3

Related Questions