Hi,
I'm having some trouble with my NHibernate right now.
My database stores information about what an respondent answered on a survey.
It can be up to 20 000 answer sets so it's pretty much information.
Each answer set contains information about what was answered on each question and there can be around 300-400 questions in worst case.
Here is the mapping files:
This is a mapping file for an AnswerSet object. It's a collection of all
questions answered by one respondent.
There is also some diffirent types of questions that we need to have.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping
xmlns="urn:nhibernate-mapping-2.2"
assembly="EsMaker.Entities"
namespace="EsMaker.Entities">
<class name="AnswerSet" table="[Result].[SurveyAnswerSet]">
<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<many-to-one name="Respondent" class="SpecializedRespondent" column="SurveyPublicationRecipientId" />
<property name="PublicationId" column="SurveyPublicationId" type="int" />
<property name="StartTime" column="DateStamp" type="DateTime" />
<property name="WorkTime" type="int" />
<property name="Completed" type="Boolean" />
<property name="Paused" type="Boolean" />
<property name="Simulated" type="Boolean" />
<bag name="BasicAnswers" access="property" table="Result.SurveyAnswerBasic" lazy="false">
<key column="SurveyAnswersetId" />
<one-to-many class="BasicAnswer" />
</bag>
<bag name="MatrixAnswers" access="property" table="Result.SurveyAnswerMatrix" lazy="false">
<key column="SurveyAnswersetId" />
<one-to-many class="MatrixAnswer" />
</bag>
<bag name="DropDownMatrixAnswers" access="property" table="Result.SurveyAnswerMatrix3D" lazy="false">
<key column="SurveyAnswersetId" />
<one-to-many class="DropDownMatrixAnswer" />
</bag>
<bag name="TextAnswers" access="property" table="Result.SurveyAnswerText" lazy="false">
<key column="SurveyAnswersetId" />
<one-to-many class="TextAnswer" />
</bag>
</class>
</hibernate-mapping>
The problem is that I need to load all of this information and it needs to be pretty fast. As it is now it takes a lot of time to load the information for these sets. How can I optimize it for best performance? Is it possible to get good performance out of this? Should I change to ADO.NET for this part?
Cheers,
Yagami