Hello
I'm using nhibernate 1.2 with asp.net 2.0, MSSQL 2005.
An Object Question has Answers, Responses, Users which answered, etc.
a GetQuestion takes up to 14 seconds!
In the hibernate-debug-log i see, that there are thousends of SQL-Queries with one GetQuestion. For each answer of the Answer-Collection, each User of the Users-Collection, each Users Questions and so on... the whole Tree of a Question-Object. The Logfile of one GetQuestion reaches nearly 100MB.
That can't be lazy-loading, no?
i expected only one sql-query and the queries for the collected objects then when they are used..
With version 1.2, lazy-loading should be active per default. Inserting lazy="true" or lazy="false" at the collection-mapping or in the class-definition changes nothing.
Must lazy-loading be activated anywhere else?
Thank you very much for helping and sorry about bad english.
Patrick
Here's a snapping from the question-xml definition file:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="....." assembly="business" >
<class name="Question" table="t_question">
...
<many-to-one name="User" column="user_id" not-null="true" class=".....User" />
<set name="Answers" table="t_answer" cascade="all" inverse="true" order-by="pos asc" >
<key column="question_id" />
<one-to-many class="......Answer" />
</set>
<set name="Responses" table="t_response" order-by="CreationDate desc" >
<key column="question_id" />
<one-to-many class=".....Response" />
</set>
...
...