Hello
I have problem with mapping classes as below:

I Have the error message in this plase:
            cfg.AddAssembly("toolShopNH");

"Could not compile the mapping document:
toolShopNH.xmlMAP.Person.hbm.xml"
Inner Exception: "persistent class toolShopCl.Person, toolShopCl not
found"}
===
file version NHibernate-2.1.0.Alpha1
==
Different basic mappings works OK.
I ask for the help very much.

 public abstract class Person : IEquatable<Person>
    {
        private Guid id;
        private string firstName;
        private string lastName;
        public Person()
        {    }

        public virtual string FirstName
        {
            get
            {   return firstName;  }
            set
            {     firstName = value; }
        }

        public virtual string LastName
        {
            get
            {   return lastName; }
            set
            {    lastName = value;}
        }

        public virtual Guid Id
        {
            get
            {  return id; }
            set
            {  id = value;   }
        }
} //end Person

public class Customer : Person, IEquatable<Customer> {

                private string factory;
                private Int32 customerId;
                private List<Task> m_Task;

                public Customer(){
                }

                ///
                /// <param name="MyTask"></param>
        public virtual void AddTask(Task MyTask)
        {

                }
                ///
                /// <param name="Id"></param>
                public void DeleteTask(Task Task){
                }

                public virtual string Factory{
                        get{return factory;
                        }
                        set{factory = value;}
                }

        public virtual Int32 CustomerId
        {
                        get{    return customerId;
                        }
                        set{    customerId = value;}
                }
}//end Customer

 public class Worker : Person, IEquatable<Worker>
    {
        private string sapNumber;
        private DateTime beginDate;
        private DateTime endDate;
        private List<OperationOnMachine> m_OperationOnMachine;

        public Worker()
        {    }

        public virtual DateTime BeginDate
        {
            get
            {return this.beginDate; }
            set
            {  this.beginDate = value;  }
        }

        public virtual DateTime EndDate
        {
            get
            {  return this.endDate; }
            set
            {  this.endDate = value; }
        }

        ///
        /// <param name="MyWork"></param>
        public void AddWorkInfo(OperationOnMachine MyWork)
        { }

        ///
        /// <param name="OperationInfo"></param>
        public List<OperationOnMachine> SearchWorkInfo(params string[]
OperationInfo)
        { return null; }

        ///
        /// <param name="Id"></param>
        public void DeleteWorkInfo(Guid Id)
        { }

        public virtual string SapNumber
        {
            get
            {  return this.sapNumber;  }
            set
            {   this.sapNumber = value;    }
        }

        public override string ToString()
        {
            return "Id:" + this.Id + " LName:" + this.LastName + "
FName:" + this.FirstName +
            " Begin:" + this.BeginDate.ToShortDateString() + " End:" +
this.EndDate.ToShortDateString() +
            " SAP:" + this.SapNumber;
        }


//Mapping file

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping
  xmlns="urn:nhibernate-mapping-2.2"
  namespace="toolShopCl"
  assembly="toolShopNH" >

  <class name="Person, toolShopCl"
         table="Persons"
         abstract="true"
         lazy="false">

    <id name="Id" column="Id" type="Guid" >
      <generator class="guid.comb" />
    </id>

    <discriminator>
      <column name="personType" not-null="true"  sql-type="nvarchar
(15)" />
    </discriminator>



    <property name="FirstName" column="firstName" type="String"
length="50" />
    <property name="LastName" column="lastNameName" type="String"
length="50"/>

    <subclass name="Customer, toolShopCl" extends="Person, toolShopCl"
discriminator-value="customer" >
      <property name="CustomerId" column="customerId" type="int"/>
      <property name="Factory" column="factory" type="String"
length="4"/>
    </subclass>

    <subclass name="Worker, toolShopCl" extends="Person, toolShopCl"
discriminator-value="worker" >
      <property name="SapNumber" column="sapNumber" type="String"
length="12"/>
      <property name="BeginDate" column="beginDate" type="DateTime"/>
      <property name="EndDate" column="endDate" type="DateTime" />
    </subclass>

  </class>
</hibernate-mapping>

//App
config***************************************************************************************

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
    <section name="hibernate-configuration"
             type="NHibernate.Cfg.ConfigurationSectionHandler,
NHibernate" />
  </configSections>

  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory>

      <property name="dialect">
        NHibernate.Dialect.MsSql2005Dialect
      </property>

      <property name="connection.provider">
        NHibernate.Connection.DriverConnectionProvider
      </property>

      <property name="connection.driver_class">
        NHibernate.Driver.SqlClientDriver
      </property>

      <property name="connection.connection_string">
        Server=art-PC;
        Database=ToolShop1;
        User ID = sa;
        Password=password;
      </property>

      <property name="connection.isolation">
        ReadCommitted
      </property>

      <property name="proxyfactory.factory_class">
        NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle
      </property>

    </session-factory>
  </hibernate-configuration>
</configuration>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to