首页 新闻 会员 周边 捐助

Could not compile the mapping document

0
悬赏园豆:20 [已关闭问题] 关闭于 2010-04-29 15:38

说也奇怪,添加和查找就能成功,就删除不能(更新还写好),执行删除时出现“

Could not compile the mapping document: fuck.Model.Customer.hbm.xml”异常,

映射言论是<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="fuck.Model.Customer,fuck.Model" table="Customer">
    <id name="CustomerId" type="Int32" unsaved-value="null">
      <column name="CustomerId" length="4" sql-type="int" not-null="true" unique="true" index="PK_Customer"/>
      <generator class="native" />
    </id>
    <property name="FirstName" type="String">
      <column name="FirstName" length="50" sql-type="varchar" not-null="true"/>
    </property>
    <property name="LastName" type="String">
      <column name="LastName" length="50" sql-type="varchar" not-null="true"/>
    </property>
    <property name="Version" type="int">
      <column name="Version" length="4" sql-type="int" not-null="true"/>
    </property>

    <!--一对多关系:Customer有一个或多个Orders-->
    <set name="Order" table="Order" generic="true" inverse="true">
      <key column="CustomerId" foreign-key="FK_Order_Customer"/>
      <one-to-many class="fuck.Model.Order,fuck.Model"/>
    </set>
  </class>
</hibernate-mapping>

删除事件是

private void buttonDelect_Click(object sender, EventArgs e)
        {
            
            int path =Int32.Parse( this.textBoxCustomerId.Text);
            Customer customer = reference.Find_Customer(path);
            reference.Delect(customer);
        }

public Customer Find_Customer(int i)
        {
            Customer customer;
            customer = operation.FindCustomerMessage(i);
            return customer;
        }

 public Customer FindCustomerMessage(int I)
       {
           ISession session = ISession_Factory.OpenSession("fuck.Model");
           transaction =session.BeginTransaction();
           Customer   customer;
           try
           {
               customer =(Customer) session.Get(typeof(Customer),I);
               transaction.Commit();
           }
           catch (Exception e)
           {
               transaction.Rollback();
               throw e;
           }
           finally
           {
               session.Close();
           }
           return customer;
       }

天上天的主页 天上天 | 初学一级 | 园豆:155
提问于:2010-04-14 21:55
< >
分享
所有回答(1)
0

同问

Seaurl | 园豆:5 (初学一级) | 2013-08-02 11:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册