Unknown entity class: NhibernateSample1.Person用过的大侠请你指点一二吧.为啥在:
ISessionFactory Factory = cfg.BuildSessionFactory();
                ISession session = Factory.OpenSession();
                ITransaction trans = session.BeginTransaction();
                session.Save(ps);//这一步就报错

解决方案 »

  1.   

    //配置Configuration
    Configuration cfg = new Configuration().Configure();//创建ISessionFactory 
    ISessionFactory factory = cfg.BuildSessionFactory();//定义事务
    ITransaction tx = null;//打开ISession
    ISession session = factory.OpenSession();
    try{    //开始事务   
         tx = session.BeginTransaction(); 
           // 在这里添加操作    
         tx.Commit();
    }catch(HibernateException ex)
    {   
        if (tx!=null) tx.Rollback();  
         throw ex;
    }finally
    {   
       //关闭ISession   
        session.Close();
    }看看对你有用没?
      

  2.   

    你的对象ps新建了吗?赋值了吗?XML文件映射对了吗?XML文件设置为内嵌资源了吗?