Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# XML NHibernate
Hi,
I have a problem with table mapping, I cannot find any error, maybe I have badly written composite-key... Table name and class name is Player_in_Tournament, there is no error...
 
Error: Could not compile the mapping document: Player_in_Tournament.hbm.xml
 
Web Form where the Exception is raised:
protected void btnRegister_Click(object sender, EventArgs e)
...
new Insert_Player().Create_Player(tbNickname.Text, tbName.Text, tbSurname.Text, gender, tbEmail.Text);   //here is the error
...
 
Tournament.hbm.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="Entities"
                   assembly="Entities">
 
  <class name="Player_in_Tournament" table="Player_in_Tournament">
    <composite-id>
      <key-property name="Player_ID" column="Player_ID" type="string" />
      <key-property name="Tournament_ID" column="Tournament_ID" type="int" />
    </composite-id>
 
    <property name="Team_ID"  column="Team_ID" type="int"/>
    <property name="Pozice"  column="Pozice" type="string"/>
  </class>
</hibernate-mapping>
 
Player_in_Tournament_ID:
public class Player_in_Tournament_ID
    {
        public virtual String Player_ID { get; set; }
        public int Tournament_ID { get; set; }
 
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            Player_in_Tournament_ID id = (Player_in_Tournament_ID)obj;
            if (id == null)
                return false;
            if (Player_ID == id.Player_ID && Tournament_ID == id.Tournament_ID)
                return true;
            return false;
        }
    }
 
Player_in_Tournament:
public class Player_in_Tournament
    {
        public virtual Player_in_Tournament_ID Player_in_Tournament_ID { get; set; }
        public virtual int Team_ID { get; set; }
        public virtual String Pozice { get; set; }
    }
Can anyone solve this error?
 
Thanks!
 
-Pepin z Hane
Posted 13-Nov-12 8:23am
Edited 13-Nov-12 12:24pm
v6
Comments
joshrduncan2012 at 13-Nov-12 14:59pm
   
Where is the error pointing to?
Pepin z Hane at 13-Nov-12 17:24pm
   
I have updated the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 512
1 Maciej Los 445
2 Sergey Alexandrovich Kryukov 421
3 CPallini 200
4 _Asif_ 135
0 Sergey Alexandrovich Kryukov 6,813
1 OriginalGriff 5,342
2 Peter Leow 3,837
3 Mika Wendelius 2,850
4 CHill60 2,748


Advertise | Privacy | Mobile
Web04 | 2.8.150224.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100