我今天遇到了end-to-text异常问题了
求助啦~
运行一个sql语句的时候提示的。但是如果不是运行sql语句只是运行session.CreateCriteria()就没有问题string hql = "from Vendor where ID=1";
IQuery query = session.CreateQuery(hql);
IList vendors = query.List();
这样的就提示错误

解决方案 »

  1.   

    是hql面向对象
    from 命名空间.Vendor v  where v.ID=1
      

  2.   

    疯了。。在家里做呢么变成Could not compile the mapping document
      

  3.   

    <?xml version="1.0" encoding="utf-8"?>
    <hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory name="NhibernateTest">
    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    <property name="connection.connection_string">
    Data Source=FOUNDER-TECH\SQLEXPRESS;Initial Catalog=TIMESHEETTESTDB.MDF;
    Persist Security Info=True;User ID=sa;Password=xiaoqiang
    </property>
    <property name="adonet.batch_size">30</property>
    <property name="show_sql">true</property>
    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
    <property name="use_outer_join">true</property>
    <property name="command_timeout">10</property>
    <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
        <mapping assembly="NhibernateTest"/>    
    </session-factory>
    </hibernate-configuration>
    <?xml version="1.0" encoding="utf-8" ?>
    <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
      <class name ="Tables" table="DicTable">
        <id name="AssortID" column="AssortID" type="byte">
          <generator class ="identity"></generator>
        </id>
          <property name ="AssortName" column="AssortName" type="string" length="20" not-null="true"/>
      </class>
    </hibernate-mapping>
    using System;
    using System.Collections.Generic;
    using System.Text;namespace NhibernateTest
    {
        class DicTables
        {
            private string m_AssortID = string.Empty;
            private string m_AssortName = string.Empty;        public DicTables()
            { 
            }        public virtual string  AssortID
            {
                get
                {
                    return m_AssortID;
                }
                set
                {
                    m_AssortName = value;
                }
            }
            public virtual string AssortName
            {
                get
                {
                    return m_AssortName;
                }
                set
                {
                    m_AssortName = value;
                }
            }    }
    }
      

  4.   

    <class name ="Tables" table="DicTable"> 
    上边这一句有问题,name应该你的实体类的信息 格式为"类全名(包含命名空间),程序集名",根据你上边实体类的信息应该写为
    name="NhibernateTest.DicTables,NhibernateTest" ,
    table对应的是你数据库的表的名称,你上边写的是DicTable,不知道DicTable是不是数据库中的表名称,自己检查下。