I have a very huge graph and the entity i am trying to load has 12
properties that are lazy loaded.

the following is the hbm file for the entity i a trying to load.

 <class name="Business.VoterEntity, Business.Entities" lazy="true"
table="Voter" schema="Hava" where="((SysStatusID is null) or
(SysStatusID = 1))">
    <id name="ID" access="property" column="VoterID"
type="System.Int64">
      <generator class="identity" />
    </id>
    <timestamp name="SysDatabaseTime" access="field.camelcase-
underscore" column="SysDatabaseTime" unsaved-value="null"
generated="always" />
    <property name="PersonIDField" access="field.camelcase-underscore"
type="System.Int64" column="PersonID" update="false" insert="false" />
    <property name="AvAddressIDField" access="field.camelcase-
underscore" type="System.Int64" column="AvAddressID" update="false"
insert="false" />
    <property name="Affidavit" access="field.camelcase-underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="Affidavit" not-null="false" />
    <property name="ManualPrecinct" access="field.camelcase-
underscore" type="System.Boolean" column="ManualPrecinct" not-
null="false" />
    <property name="PrecinctPortionIDField" access="field.camelcase-
underscore" type="System.Int64" column="PrecinctPortionID"
update="false" insert="false" />
    <property name="PartyIDField" access="field.camelcase-underscore"
type="System.Int64" column="PartyID" update="false" insert="false" />
    <property name="SigDate" access="field.camelcase-underscore"
type="System.DateTime" column="SigDate" not-null="false" />
    <property name="RegisteredDate" access="field.camelcase-
underscore" type="System.DateTime" column="RegisteredDate" not-
null="false" />
    <property name="OriginalRegisteredDate" access="field.camelcase-
underscore" type="System.DateTime" column="OriginalRegisteredDate" not-
null="false" />
    <property name="ReceiveDate" access="field.camelcase-underscore"
type="System.DateTime" column="ReceiveDate" not-null="false" />
    <property name="ImageIDField" access="field.camelcase-underscore"
type="System.Int64" column="ImageID" update="false" insert="false" />
    <property name="Confidential" access="field.camelcase-underscore"
type="System.Boolean" column="Confidential" not-null="false" />
    <property name="VoterAbsenteeCategoryIDField"
access="field.camelcase-underscore" type="System.Int64"
column="VoterAbsenteeCategoryID" update="false" insert="false" />
    <property name="VoterAbsenteeDeliveryIDField"
access="field.camelcase-underscore" type="System.Int64"
column="VoterAbsenteeDeliveryID" update="false" insert="false" />
    <property name="DateEntered" access="field.camelcase-underscore"
type="System.DateTime" column="DateEntered" not-null="false" />
    <property name="RecruitmentBypass" access="field.camelcase-
underscore" type="System.Boolean" column="RecruitmentBypass" not-
null="false" />
    <property name="StateIDNumber" access="field.camelcase-underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="StateIDNumber" not-null="false" />
    <property name="ValidationDate" access="field.camelcase-
underscore" type="System.DateTime" column="ValidationDate" not-
null="false" />
    <property name="StateAuditFlag" access="field.camelcase-
underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="StateAuditFlag" not-null="false" />
    <property name="ContactIDField" access="field.camelcase-
underscore" type="System.Int64" column="ContactID" update="false"
insert="false" />
    <property name="VoterRegistrationBatchIDField"
access="field.camelcase-underscore" type="System.Int64"
column="VoterRegistrationBatchID" update="false" insert="false" />
    <property name="NeedsIDNumber" access="field.camelcase-underscore"
type="System.Boolean" column="NeedsIDNumber" not-null="false" />
    <property name="PriorJurisdictionIDField" access="field.camelcase-
underscore" type="System.Int64" column="PriorJurisdictionID"
update="false" insert="false" />
    <property name="IsSpecialAssistanceRequired"
access="field.camelcase-underscore" type="System.Boolean"
column="IsSpecialAssistanceRequired" not-null="false" />
    <property name="LanguageIDField" access="field.camelcase-
underscore" type="System.Int64" column="LanguageID" update="false"
insert="false" />
    <property name="ScannedSignaturePath" access="field.camelcase-
underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="ScannedSignaturePath" not-null="false" />
    <property name="ScannedAffidavitPath" access="field.camelcase-
underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="ScannedAffidavitPath" not-null="false" />
    <property name="IsAllElections" access="field.camelcase-
underscore" type="System.Boolean" column="IsAllElections" not-
null="false" />
    <property name="IsSomeElections" access="field.camelcase-
underscore" type="System.Boolean" column="IsSomeElections" not-
null="false" />
    <property name="IsOverseas" access="field.camelcase-underscore"
type="System.Boolean" column="IsOverseas" not-null="false" />
    <property name="IsRemoteAK" access="field.camelcase-underscore"
type="System.Boolean" column="IsRemoteAK" not-null="false" />
    <property name="DateBecameConfidential" access="field.camelcase-
underscore" type="System.DateTime" column="DateBecameConfidential" not-
null="false" />
    <property name="DateConfidentialExpires" access="field.camelcase-
underscore" type="System.DateTime" column="DateConfidentialExpires"
not-null="false" />
    <property name="IsSealed" access="field.camelcase-underscore"
type="System.Boolean" column="IsSealed" not-null="false" />
    <property name="HasOptOutOfVIG" access="field.camelcase-
underscore" type="System.Boolean" column="HasOptOutOfVIG" not-
null="false" />
    <property name="IsPotentialWorker" access="field.camelcase-
underscore" type="System.Boolean" column="IsPotentialWorker" not-
null="false" />
    <property name="IsExemptFromRequiredIDNumber"
access="field.camelcase-underscore" type="System.Boolean"
column="IsExemptFromRequiredIDNumber" not-null="false" />
    <property name="VoterExemptionReasonID" access="field.camelcase-
underscore" type="System.Int64" column="VoterExemptionReasonID" not-
null="false" />
    <property name="IsIncludedForBusinessReplyAccount"
access="field.camelcase-underscore" type="System.Boolean"
column="IsIncludedForBusinessReplyAccount" not-null="false" />
    <property name="Returned8d2Date" access="field.camelcase-
underscore" type="System.DateTime" column="Returned8d2Date" not-
null="false" />
    <property name="IDStatusDate" access="field.camelcase-underscore"
type="System.DateTime" column="IDStatusDate" not-null="false" />
    <property name="BatchProcessDate" access="field.camelcase-
underscore" type="System.DateTime" column="BatchProcessDate" not-
null="false" />
    <property name="PriorHouseDistrictIDField" access="field.camelcase-
underscore" type="System.Int64" column="PriorHouseDistrictID"
update="false" insert="false" />
    <property name="CommentIDField" access="field.camelcase-
underscore" type="System.Int64" column="CommentID" update="false"
insert="false" />
    <property name="VoterStatusID" access="field.camelcase-underscore"
type="System.Int64" column="VoterStatusID" not-null="false" />
    <property name="VoterReasonID" access="field.camelcase-underscore"
type="System.Int64" column="VoterReasonID" not-null="false" />
    <property name="RegisteredDateHouseAK" access="field.camelcase-
underscore" type="System.DateTime" column="RegisteredDateHouseAK" not-
null="false" />
    <property name="RegisteredDateSenateAK" access="field.camelcase-
underscore" type="System.DateTime" column="RegisteredDateSenateAK" not-
null="false" />
    <property name="RegisteredDateJudicialAK" access="field.camelcase-
underscore" type="System.DateTime" column="RegisteredDateJudicialAK"
not-null="false" />
    <property name="VoterRegistrationDeliveryMethodIDField"
access="field.camelcase-underscore" type="System.Int64"
column="VoterRegistrationDeliveryMethodID" update="false"
insert="false" />
    <property name="VoterRegistrationSourceIDField"
access="field.camelcase-underscore" type="System.Int64"
column="VoterRegistrationSourceID" update="false" insert="false" />
    <property name="IsSendNoticeVNC" access="field.camelcase-
underscore" type="System.Boolean" column="IsSendNoticeVNC" not-
null="false" />
    <property name="IsSendNoticeMIN" access="field.camelcase-
underscore" type="System.Boolean" column="IsSendNoticeMIN" not-
null="false" />
    <property name="IsSendNotice8d2" access="field.camelcase-
underscore" type="System.Boolean" column="IsSendNotice8d2" not-
null="false" />
    <property name="DateBecamePVBM" access="field.camelcase-
underscore" type="System.DateTime" column="DateBecamePVBM" not-
null="false" />
    <property name="RestoredDate" access="field.camelcase-underscore"
type="System.DateTime" column="RestoredDate" not-null="false" />
    <property name="SuspendedDate" access="field.camelcase-underscore"
type="System.DateTime" column="SuspendedDate" not-null="false" />
    <property name="RegistrarIDField" access="field.camelcase-
underscore" type="System.Int64" column="RegistrarID" update="false"
insert="false" />
    <property name="IsPAV" access="field.camelcase-underscore"
type="System.Boolean" column="IsPAV" not-null="false" />
    <property name="Sent8d2Date" access="field.camelcase-underscore"
type="System.DateTime" column="Sent8d2Date" not-null="false" />
    <property name="IsSendFAN" access="field.camelcase-underscore"
type="System.Boolean" column="IsSendFAN" not-null="false" />
    <property name="IsSendPJN" access="field.camelcase-underscore"
type="System.Boolean" column="IsSendPJN" not-null="false" />
    <property name="SentPJNDate" access="field.camelcase-underscore"
type="System.DateTime" column="SentPJNDate" not-null="false" />
    <property name="SentFANDate" access="field.camelcase-underscore"
type="System.DateTime" column="SentFANDate" not-null="false" />
    <property name="ReasonDate" access="field.camelcase-underscore"
type="System.DateTime" column="ReasonDate" not-null="false" />
    <property name="DistrictResideDate" access="field.camelcase-
underscore" type="System.DateTime" column="DistrictResideDate" not-
null="false" />
    <property name="MailingAddressIDField" access="field.camelcase-
underscore" type="System.Int64" column="MailingAddressID"
update="false" insert="false" />
    <property name="IsExtended" access="field.camelcase-underscore"
type="System.Boolean" column="IsExtended" not-null="false" />
    <property name="VoterIDNumber" access="field.camelcase-underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="VoterIDNumber" not-null="false" />
    <property name="IsDuplicateAnalysis" access="field.camelcase-
underscore" type="System.Boolean" column="IsDuplicateAnalysis" not-
null="false" />
    <property name="SysEffectiveStart" access="field.camelcase-
underscore" type="System.DateTime" column="SysEffectiveStart" not-
null="false" />
    <property name="SysEffectiveEnd" access="field.camelcase-
underscore" type="System.DateTime" column="SysEffectiveEnd" not-
null="false" />
    <property name="SysLoginID" access="field.camelcase-underscore"
type="System.Int64" column="SysLoginID" not-null="false" />
    <property name="SysActionID" access="field.camelcase-underscore"
type="System.Int64" column="SysActionID" not-null="false" />
    <property name="SysStatusID" access="field.camelcase-underscore"
type="System.Int64" column="SysStatusID" not-null="false" />
    <property name="SysLink" access="field.camelcase-underscore"
type="System.Int64" column="SysLink" not-null="false" />
    <property name="SysPermissionID" access="field.camelcase-
underscore" type="System.Int64" column="SysPermissionID" not-
null="false" />
    <property name="SysScenarioID" access="field.camelcase-underscore"
type="System.Int64" column="SysScenarioID" not-null="false" />
    <property name="SysOperation" access="field.camelcase-underscore"
type="System.Guid" column="SysOperation" not-null="false" />
    <property name="SysJurisdiction" access="field.camelcase-
underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="SysJurisdiction" not-null="false" />
    <property name="SysSecurity" access="field.camelcase-underscore"
type="Helios.Repository.UDT.EmptyStringUserType,Helios.Repository"
column="SysSecurity" not-null="false" />
    <property name="SysComponent" access="field.camelcase-underscore"
type="System.Guid" column="SysComponent" not-null="false" />
    <many-to-one name="PersonID" access="field.camelcase-underscore"
class="Business.Common.Entities.PersonEntity, Business.Entities"
column="PersonID" cascade="merge,save-update,persist,refresh,lock"
fetch="select" lazy="proxy" />
    <many-to-one name="AvAddressID" access="field.camelcase-
underscore" class="Business.Common.Entities.AddressEntity,
Business.Entities" column="AvAddressID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="PrecinctPortionID" access="field.camelcase-
underscore" class="Business.PrecinctPortionEntity, Business.Entities"
column="PrecinctPortionID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="PartyID" access="field.camelcase-underscore"
class="Business.Common.Entities.PartyEntity, Business.Entities"
column="PartyID" cascade="merge,save-update,persist,refresh,lock"
fetch="select" lazy="proxy" />
    <many-to-one name="ImageID" access="field.camelcase-underscore"
class="Business.Common.Entities.ImageEntity, Business.Entities"
column="ImageID" cascade="merge,save-update,persist,refresh,lock"
fetch="select" lazy="proxy" />
    <many-to-one name="VoterAbsenteeCategoryID"
access="field.camelcase-underscore"
class="Business.VoterAbsenteeCategoryEntity, Business.Entities"
column="VoterAbsenteeCategoryID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="VoterAbsenteeDeliveryID"
access="field.camelcase-underscore"
class="Business.VoterAbsenteeDeliveryEntity, Business.Entities"
column="VoterAbsenteeDeliveryID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="ContactID" access="field.camelcase-underscore"
class="Business.Common.Entities.ContactEntity, Business.Entities"
column="ContactID" cascade="none" fetch="select" lazy="proxy" />
    <many-to-one name="VoterRegistrationBatchID"
access="field.camelcase-underscore"
class="Business.VoterRegistrationBatchEntity, Business.Entities"
column="VoterRegistrationBatchID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="PriorJurisdictionID" access="field.camelcase-
underscore" class="Business.Common.Entities.JurisdictionEntity,
Business.Entities" column="PriorJurisdictionID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="LanguageID" access="field.camelcase-underscore"
class="Business.Common.Entities.LanguageEntity, Business.Entities"
column="LanguageID" cascade="merge,save-update,persist,refresh,lock"
fetch="select" lazy="proxy" />
    <many-to-one name="PriorHouseDistrictID" access="field.camelcase-
underscore" class="Business.DistrictEntity, Business.Entities"
column="PriorHouseDistrictID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="CommentID" access="field.camelcase-underscore"
class="Business.Common.Entities.CommentEntity, Business.Entities"
column="CommentID" cascade="merge,save-update,persist,refresh,lock"
fetch="select" lazy="proxy" />
    <many-to-one name="VoterRegistrationDeliveryMethodID"
access="field.camelcase-underscore"
class="Business.VoterRegistrationDeliveryMethodEntity,
Business.Entities" column="VoterRegistrationDeliveryMethodID"
cascade="merge,save-update,persist,refresh,lock" fetch="select"
lazy="proxy" />
    <many-to-one name="VoterRegistrationSourceID"
access="field.camelcase-underscore"
class="Business.VoterRegistrationSourceEntity, Business.Entities"
column="VoterRegistrationSourceID" cascade="merge,save-
update,persist,refresh,lock" fetch="select" lazy="proxy" />
    <many-to-one name="RegistrarID" access="field.camelcase-
underscore" class="Business.RegistrarEntity, Business.Entities"
column="RegistrarID" cascade="merge,save-update,persist,refresh,lock"
fetch="select" lazy="proxy" />
    <many-to-one name="MailingAddressID" access="field.camelcase-
underscore" class="Business.Common.Entities.AddressEntity,
Business.Entities" column="MailingAddressID" cascade="none"
fetch="select" lazy="proxy" />
  </class>


Sravan

On Sep 18, 4:36 am, Tuna Toksoz <[email protected]> wrote:
> Slow performances for the first time is ok, there is a lot going on and nh
> is lazy in doing things, until you do something it won't create cache, to
> name a few.
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
> On Fri, Sep 18, 2009 at 7:23 AM, Oskar Berggren 
> <[email protected]>wrote:
>
>
>
> > As Tuna says, be sure to not open two sessions if you in the future
> > create a use case where two or more objects are retrieved and edited
> > together.
>
> > Nonetheless, ten seconds for getting one object, and even two seconds
> > on subsequent calls is ridiculous.
>
> > The times you mention, are they executing time for your Get(), or for
> > only the call to session.Get()?
>
> > Does the first call include the time to configure and build the
> > session factory? If it does, this could explain the whole or part of
> > the 8 second difference, unless your domain model is very small.
>
> > If your sql server is slow to respond on connection requests (slow
> > server, network problem, etc.) some time difference could be explained
> > by this, since on the second request the connection is already
> > available thanks to connection pooling (unless you've turned that
> > off).
>
> > Now, two seconds for a subsequent call also seems overly much. Does
> > you object have a bunch of eagerly initialized collections or other
> > relations? How many sql queries are executed? Is connection pooling
> > working? If you do the same SQL query manually, how long does it take?
> > Is the database indexed properly? Does the database engine use the
> > index?
>
> > Committing the transaction when you have only fetched data seems
> > unnecessary and unclean.
>
> > /Oskar
>
> > 2009/9/18 Tuna Toksoz <[email protected]>:
> > > What if you get two objects and save 2 times?
>
> > > Tuna Toksöz
> > > Eternal sunshine of the open source mind.
>
> > >http://devlicio.us/blogs/tuna_toksoz
> > >http://tunatoksoz.com
> > >http://twitter.com/tehlike
>
> > > On Fri, Sep 18, 2009 at 1:39 AM, Sravan Kumar
> > > <[email protected]> wrote:
>
> > >> I am following unit of work pattern. UI tier calls Business tier to get
> > an
> > >> entiy with ID.
>
> > >> Gettting an objec with ID is Unit Of work in this example. I Get an
> > entity
> > >> bind it to UI and then do some modifications and then calls
>
> > >> Save. Save is a another unit of work.
>
> > >> Thank you very much .
> > >> Sravan
>
> > >> On Thu, Sep 17, 2009 at 6:33 PM, Tuna Toksoz <[email protected]> wrote:
>
> > >>> Opening a session in every operation is bad. You loose unit of work +
> > >>> first level cache etc.
> > >>> Don't do it.
>
> > >>> Tuna Toksöz
> > >>> Eternal sunshine of the open source mind.
>
> > >>>http://devlicio.us/blogs/tuna_toksoz
> > >>>http://tunatoksoz.com
> > >>>http://twitter.com/tehlike
>
> > >>> On Thu, Sep 17, 2009 at 9:31 PM, sravan <
> > [email protected]>
> > >>> wrote:
>
> > >>>> I have a Get Method that takes the ID of the entity and gives the
> > >>>> object with that ID.
>
> > >>>> In the Get Method I open a new session and calls Get on the session.
>
> > >>>> the first call to get takes 10 sec, but subsequent calls to get takes
> > >>>> just  2 seconds.
>
> > >>>> I do not have second level caching enabled.
>
> > >>>> I ran the sql server profiler and it is taking the same time to
> > >>>> execute the query in both the cases.
>
> > >>>> Not able to figure out why it is taking so long time for first call to
> > >>>> get.
>
> > >>>> Any help is Greatly appreciated.
>
> > >>>> The second call is invoked on a different session.
>
> > >>>> public virtual T Get( long ID )
> > >>>>                {
>
> > >>>>            if ( null == Interceptor ) throw new TechnicalException
> > >>>> ( "RepositoryBase::Get: ERROR: Interceptor must be set prior to use of
> > >>>> this class." );
>
> > >>>>                        T entity = null;
> > >>>>                        using ( ISession session =
> > >>>> NHibernateSessionFactorySingleton.GetSession( Interceptor ) )
> > >>>>                        {
> > >>>>                                using ( ITransaction transaction =
> > >>>> session.BeginTransaction( ) )
> > >>>>                                {
>
> > >>>>                                        session.FlushMode =
> > >>>> FlushMode.Never;
>
> > >>>>                                        T entity = session.Get<T>( ID
> > );
>
> > >>>>                                        transaction.Commit( );
> > >>>>                                }
>
> > >>>>                        }
>
> > >>>>                        return entity;
> > >>>>                }
>
> > >>>> Sravan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to