• 求解:nhibernate2.0操作oralce提交事务时报错


    代码如下:

      Configuration config = new Configuration();
                    config.AddAssembly("TestCleanSnow");
                   
                   
                    ISessionFactory factory = config.BuildSessionFactory();
                    ISession session = factory.OpenSession();

                  

                    TestNhibernate tn = new TestNhibernate();
                    tn.Id = Decimal.Parse("2");
                    tn.Name = "terry wang";
                   ITransaction trans = session.BeginTransaction();
               try
               {             

                   session.Save(tn);
                   trans.Commit();
                  
                   Console.WriteLine("Insert Success!");
               }
               catch (Exception ex)
               {
                   trans.Rollback();
                   Console.WriteLine(ex.Message);
               }

    执行到trans.Commit()时出错,

    出错信息如下:

    NHibernate.HibernateException :"could not insert: [TestCleanSnow.TestNhibernate][SQL: INSERT INTO TEST_NHIBERNATE ([NAME], ID) VALUES (?, ?)]"}

    InnerText:ORA-00928: 缺少 SELECT 关键字

    我在控制台调试看到输出NHibernate的语句是: INSERT INTO TEST_NHIBERNATE ([NAME], ID) VALUES (:p0, :p1); :p0 = 'terryerry wang', :p1 = '2'

    请问是哪里出错?

  • 相关阅读:
    Windows10 JDK1.8安装及环境变量配置
    Adobe Premiere Pro 2020破解教程
    如何消除任务栏系统更新失败的图标
    微服务架构-Gradle下载安装配置教程
    第十五次-语法制导的语义翻译
    第十四次——算符优先分析
    第09组 Alpha冲刺(4/4)
    第09组 Alpha冲刺(3/4)
    第09组 Alpha冲刺(2/4)
    第09组 Alpha冲刺(1/4)
  • 原文地址:https://www.cnblogs.com/abcdwxc/p/1389808.html
Copyright © 2020-2023  润新知