Hi,
im using nhibernate in my project for 2 month now, and im trying to improve the perfomance of my web app.
The thing is that i have a class with a lot of many-to-one relationship. And the performance have drop significantly.
In my app i have to display a list of media(tv, radio etc) and when i have under 50 result to display its not so bad but when its 150 result it take like 15 sec to display the list. All the collections are lazyloaded but I would like to lazyload almost every member of the class.
So I found this post on the forum and I read the documentation about the lazy load attribute of the <class> tag and the proxy attribute. But after reading the doc i still not understand how the proxy attribute works and what should it be equal to.
I tried to put the proxy = to my class name and make the properties virtual in my class, but when i run the apps and look in my dropdownlist I have the Id of the object instead of the string that should appear. When i put the proxy attribute I don t understand what im i doing. Can anybody explain it to me or give me an url of a more detail documentation about this please.
Thank you
Simon
here s the mapping of my Media Class
Code:
<class name="Datablitz.Engine.objets.BaseMedia, Datablitz.Engine" table="Media">
<jcs-cache usage="read-write"/>
<id name="IdMedia" column="IdMedia" type="Int32">
<generator class="identity" />
</id>
<property name="Nom" column="Nom" type="String" length="75"/>
<property name="SiteWeb" column="SiteWeb" type="String" length="75"/>
<property name="Courriel" column="Courriel" type="String" length="75"/>
<bag name="Adresses" table="JN_Media_Adresse" lazy="true">
<jcs-cache usage="read-write"/>
<key column="IdMedia"/>
<many-to-many class="Datablitz.Engine.objets.Adresse, Datablitz.Engine" column="IdAdresse"/>
</bag>
<set name="Categories" table="JN_Media_Categorie" lazy="true">
<jcs-cache usage="read-write"/>
<key column="IdMedia"/>
<many-to-many class="Datablitz.Engine.objets.Categorie, Datablitz.Engine" column="IdCategorie"/>
</set>
<set name="Langues" table="JN_Media_langue" lazy="true">
<jcs-cache usage="read-write"/>
<key column="IdMedia"/>
<many-to-many class="Datablitz.Engine.objets.Langue, Datablitz.Engine" column="IdLangue"/>
</set>
<set name="Telephones" table="JN_Media_Telephone" lazy="true">
<jcs-cache usage="read-write"/>
<key column="IdMedia"/>
<many-to-many class="Datablitz.Engine.objets.Telephone, Datablitz.Engine" column="IdTelephone"/>
</set>
<set name="Ethnies" table="JN_Media_Ethnies" lazy="true">
<jcs-cache usage="read-write"/>
<key column="IdMedia"/>
<many-to-many class="Datablitz.Engine.objets.Ethnie, Datablitz.Engine" column="IdEthenies"/>
</set>
<many-to-one name="TypeMedia" class="Datablitz.Engine.objets.TypeMedia, Datablitz.Engine" column="IdTypeMedia" not-null="true" />
<many-to-one name="TypeAudience" class="Datablitz.Engine.objets.TypeAudience, Datablitz.Engine" column="IdTypeAudience" not-null="true" />
<many-to-one name="TypeTerritoireCouvert" class="Datablitz.Engine.objets.TypeTerritoireCouvert, Datablitz.Engine" column="IdTypeTerritoireCouvert" not-null="true" />
<many-to-one name="Note" class="Datablitz.Engine.objets.Note, Datablitz.Engine" column="IdNote" not-null="true" />
<many-to-one name="Proprietaire" class="Datablitz.Engine.objets.BaseMedia, Datablitz.Engine" column="IdProprietaire" not-null="true"/>
<joined-subclass name="Datablitz.Engine.objets.MediaRadio, Datablitz.Engine" table="MediaRadio">
<key column="IdMedia"/>
<property name="Frequence" type="String" column="Frequence" length="10"/>
<property name="Puissance" type="Int32" column="Puissance"/>
<property name="StyleMusique" type="String" column="StyleMusique" length="50"/>
<property name="GroupeAge" type="String" column="GroupeAge" length="50"/>
<many-to-one name="TypeBande" class="Datablitz.Engine.objets.TypeBande, Datablitz.Engine" column="IdTypeBande" not-null="true" />
<many-to-one name="TypeProfilRadio" class="Datablitz.Engine.objets.TypeProfilRadio, Datablitz.Engine" column="IdTypeProfilRadio" not-null="true" />
<many-to-one name="TypeCibleRadio" class="Datablitz.Engine.objets.TypeCibleRadio, Datablitz.Engine" column="IdTypeCibleRadio" not-null="true" />
</joined-subclass>
</class>