代码如下:
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'
请问是哪里出错?