fluentmapping を使用して、Oracle の既存のデータベースに接続しようとしています。お客様よりマッピングを取得しました
public CustomerMapping()
{
Not.LazyLoad();
Id(x => x.Cst_Recid).GeneratedBy.Increment() ;
}
そして私はセッションを作成しようとしています
public static ISessionFactory CreateSessionFactory()
{
return Fluently
.Configure()
.Database(OracleClientConfiguration.Oracle10.ConnectionString
("...."))
.Mappings(m =>
{
m.FluentMappings.AddFromAssemblyOf<CustomerMapping>();
})
.BuildConfiguration()
.BuildSessionFactory();
}
sessionFactory を試して作成するトライアル クラスがあります。
public class MyDataProvider
{
public static Customer GetCustomerById(long customerId)
{
ISessionFactory sessionFactory = SessionFactory.CreateSessionFactory();
ISession session = sessionFactory.OpenSession();
return session.Linq<Customer>().Where(x => x.Cst_Recid.Equals(temp)).FirstOrDefault();
}
}
セッションを開いてアクティブ化しても、ID で顧客を取得できません...
テストは非常に単純です - 選択したアクティビティをチェックするだけです
[Test]
public void CanGetCustomerById()
{
MyDataProvider provider = new MyDataProvider();
Assert.AreEqual(33941, MyDataProvider.GetCustomerById(33941).Cst_Recid);
}
間違いがあります -
TestCase '...DataLayer.Tests.CustomerMappingTests.CanGetCustomerById' が失敗しました: NHibernate.ADOException : クエリを実行できませんでした [ select * from ( as Cst4_0_0_, this_.Cst_Insdbdt as Cst5_0_0_, this_.Cst_Insdbuser as Cst6_0_0_, this_.Cst_Joingroup_Dt as Cst7_0_0_, this_.Cst_Last_Name as Cst8_0_0_, this_.Cst_Lastupddt as Cst9_0_0_, this_.Cst_Lastupduser as Cst10_0_0_, this_.Cst_Tat_Lakoach_Meshalem as Cst11_0_0_, this_.Cst_Typeid as Cst12_0_0_ , this_.Cst_Tziyun_Meshalem_Rashi_Only as Cst13_0_0_, this_.Cst_Tziyun_Mizdamen as Cst14_0_0_ FROM "Customer" this_ WHERE this_.Cst_Recid = :p0 ) where rownum <=:p1 ] 定位置パラメーター: #0>33941 [SQL: select * from ( SELECT this_.Cst_Recid Cst1_0_0_として、this_.Cst_Customerid as Cst2_0_0_, this_.Cst_First_Name as Cst3_0_0_, this_.Cst_Group_Recid as Cst4_0_0_, this_.Cst_Insdbdt as Cst5_0_0_, this_.Cst_Insdbuser as Cst6_0_0_, this_.Cst_Joingroup_Dt as Cst7_0_0_, this_.Cst_Last_Name as Cst8_0_0_, this_.Cst_Lastupddt as Cst9_0_0_, this_. Cst_Lastupduser as Cst10_0_0_, this_.Cst_Tat_Lakoach_Meshalem as Cst11_0_0_, this_.Cst_Typeid as Cst12_0_0_, this_.Cst_Tziyun_Meshalem_Rashi_Only as Cst13_0_0_, this_.Cst_Tziyun_Mizdamen as Cst14_0_0_ FROM "Customer" this_ WHERE this_.Cst_Recid = :p0 ) where rownum <=:p1] --- -> System.Data.OracleClient.OracleException : ORA-00942: テーブルまたはビューが存在しませんCst_Joingroup_Dt as Cst7_0_0_, this_.Cst_Last_Name as Cst8_0_0_, this_.Cst_Lastupddt as Cst9_0_0_, this_.Cst_Lastupduser as Cst10_0_0_, this_.Cst_Tat_Lakoach_Meshalem as Cst11_0_0_, this_.Cst_Typeid as Cst12_0_0_, this_.Cst_Tziyun_Meshalem_Rashi_Only as Cst13_0_0_, this_.Cst_Tziyun_Mizdamen as Cst14_0_0_ FROM "Customer" this_ WHERE this_.Cst_Recid = :p0 ) where rownum <=:p1] ----> System.Data.OracleClient.OracleException : ORA-00942: テーブルまたはビューが存在しませんCst_Joingroup_Dt as Cst7_0_0_, this_.Cst_Last_Name as Cst8_0_0_, this_.Cst_Lastupddt as Cst9_0_0_, this_.Cst_Lastupduser as Cst10_0_0_, this_.Cst_Tat_Lakoach_Meshalem as Cst11_0_0_, this_.Cst_Typeid as Cst12_0_0_, this_.Cst_Tziyun_Meshalem_Rashi_Only as Cst13_0_0_, this_.Cst_Tziyun_Mizdamen as Cst14_0_0_ FROM "Customer" this_ WHERE this_.Cst_Recid = :p0 ) where rownum <=:p1] ----> System.Data.OracleClient.OracleException : ORA-00942: テーブルまたはビューが存在しませんp1] ----> System.Data.OracleClient.OracleException : ORA-00942: テーブルまたはビューが存在しませんp1] ----> System.Data.OracleClient.OracleException : ORA-00942: テーブルまたはビューが存在しません
彼が実行しようとしているクエリは、 FluentNHibernate によって自動的に構築されます。引用符を削除すると、クエリが正しく実行され、結果が得られます..問題は、クエリを希望どおりに変更できないことです..おそらく問題は、Oracle 11 g を使用しており、FluentNhibernate が Oracle 9 または10 ?
どんな助けにも感謝します。