Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
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
<?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:
C#
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:
C#
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
Updated 13-Nov-12 11:24am
v6
Comments
joshrduncan2012 13-Nov-12 14:59pm    
Where is the error pointing to?
Pepin z Hane 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900