6

What is the reason of this error? My class is Course and it has notes. Mapping is as below. Any idea?

<bag name="Notes" table="NOTE" cascade="all">
      <key column="COURSEID"/>
      <one-to-many class="Server.Data.Note, Server.Data"/>
    </bag>
NetSide
  • 3,849
  • 8
  • 30
  • 41

3 Answers3

2
<bag name="Notes" table="NOTE" cascade="all" inverse="true">
      <key column="COURSEID"/>
      <one-to-many class="Server.Data.Note, Server.Data"/>
    </bag>

inverse="true" solves my problem :)

NetSide
  • 3,849
  • 8
  • 30
  • 41
2

I my case the reason was that I was mapping a list to an abstract type (during a refactoring). When I changed the class from being abstract, it worked.

Siewers
  • 22,626
  • 3
  • 20
  • 31
0

In my case the reason was that I converted an int to an enum (public enum FieldType : int { }).

Somehow, that convertion made an error jump where a Field had no Question. I made Question_id not nullable directly in the db, and removed the Fields with null question_id... and the error disappeared. (Replaced by another one, Can't parse 32 as int.. But still, improvement. I think the db type needs to be different.)

"Any sufficiently advanced technology is indistinguishable from magic."

ANeves
  • 6,219
  • 3
  • 39
  • 63