私は NHibernate クエリを持っています (これは EXTJS グリッドにデータを入力しています)
データベースに対して 2 つのクエリを実行します。1 つは (ページング目的で) レコード数を取得するためのもので、もう 1 つはグリッドを埋める上位 N 行を取得するためのものです。
コードから、Select count(*) ステートメントで常に例外が発生します。
NHibernate.Exceptions.GenericADOException:
Failed to execute multi criteria[SQL:
SELECT count(*) as y0_ FROM RecordView this_ inner join ProcessesView
process1_ on this_.ProcessId=process1_.Id inner join BusinessModelsView
businessmo3_ on process1_.BusinessModelId=businessmo3_.Id inner join BatchesView
batch2_ on this_.BatchId=batch2_.Id WHERE this_.ProcessId = ?;
] ---> System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the server
is not responding.
ただし、その正確なクエリを取得して SSMS ウィンドウにドロップして実行すると、1 秒未満で実行されます。
NHibernate は内部で何か「面白い」ことをしていますか? 実行計画/キャッシュの問題はありますか。なぜこれが起こっているのか、私は完全に途方に暮れています。