Click here to Skip to main content
12,700,567 members (33,238 online)
Rate this:
 
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
Updated 13-Nov-12 12:24pm
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2017
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