This usually means that there was no common session available for
loading the instances lazily. You have to use either SessionScope
or IConversation, depending on the type of application.
http://www.castleproject.org/activerecord/documentation/trunk/usersguide/scopes.html
http://using.castleproject.org/display/AR/Using+the+Conversation+Pattern
-Markus
2010/5/30 raghavsri <[email protected]
<mailto:[email protected]>>
Thanks for your reply
i used lazy loading,performance was really improved a lot,
but some instances i am getting
NHibernate.LazyInitializationException ..in my implementation.
Please let me know if you have any suggestion, how to handle the
things when we use lazy loading
Once again thaks for you quick response...
Regards
Raghavendra
On May 29, 12:11 pm, Markus Zywitza <[email protected]
<mailto:[email protected]>> wrote:
> You have to use lazy loading. With the current mapping, if
you load one
> sample, AR loads all the tests assigned to it, then for
every test it loads
> all the machines associated with them and then for all
machines of all tests
> of this sample it loads all results.
>
> If you had many-to-many relationships, this would be even
worse, because
> then all other reachable tests, computers and samples would
be loaded. But
> even so, you are getting a good bunch of data into memory
with a lot of
> queries.
>
> Performancewise, all HasMany-attributes should have
Lazy=true and
> Inverse=true. Ayende has written some posts on inverse and
lazyloading for
> NHibernate. Since AR uses NH, these posts are very useful.
You might also
> want to try NHProf for performance profiling with AR if
lazy loading does
> not bring enough performance.
>
> -Markus
>
> 2010/5/29 raghavsri <[email protected]
<mailto:[email protected]>>
>
>
>
> > In sample class to map sample
>
> > [HasMany(typeof(Test), Table = "Test", ColumnKey =
"SID", Inverse =
> > false,
> > Cascade = ManyRelationCascadeEnum.All)]
>
> > In test class to map sample
> > [BelongsTo("SID", NotNull = true)]
> > public virtual Sample Sample
>
> > in test class to map mahcine
> > [HasMany(Table = "Machine", ColumnKey = "TID", Inverse =
false,
> > Cascade = ManyRelationCascadeEnum.All)]
>
> > in machine class to map test
> > [BelongsTo("TID", NotNull = true)]
> > public virtual Test Test
>
> > On May 29, 2:48 am, raghavsri <[email protected]
<mailto:[email protected]>> wrote:
> > > following are the list of table
> > > sample--->test-->machine--->result
> > > user
>
> > > sample has 1 to many relationship with test ,
> > > test ,1 to many to machine
> > > machine ,1 to many result
>
> > > apart from this test is also associated with user table
>
> > > I have inserted more than 1000 rows in all these table
>
> > > when i say
> > > ActiveRecordBase<Sample>.FindOne
> > > (
> > > new ICriterion[]
> > > {
> > > Expression.Eq("SerialNumber",
serialNumber)
> > > }
> > > );
>
> > > it is taking lot of time,
>
> > > On May 29, 2:17 am, Markus Zywitza
<[email protected] <mailto:[email protected]>>
wrote:
>
> > > > Sorry, my crystal ball is off duty right now. Can you
please send us
> > your
> > > > mappings and your usage scenario?
>
> > > > -Markus
>
> > > > 2010/5/28 raghavsri <[email protected]
<mailto:[email protected]>>
>
> > > > > Hi
> > > > > I am experiencing very poor peformance ,when i am
using FindOne and
> > > > > FindAll fucntionality ,in activerecord.
> > > > > there are only 4 cascaded tables and these
functions are taking more
> > > > > time even with small amount of data(1000 Rows in
database. )
> > > > > Please can somebody tell me ,what is the actual
problem. ?(Logging is
> > > > > switched off)
> > > > > Regards
>
> > > > > --
> > > > > You received this message because you are
subscribed to the Google
> > Groups
> > > > > "Castle Project Users" group.
> > > > > To post to this group, send email to
> > [email protected]
<mailto:[email protected]>
> > > > > .
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]
<mailto:castle-project-users%[email protected]><castle-project-users%2bun[email protected]
<mailto:[email protected]>>
> > <castle-project-users%2bun[email protected]
<mailto:[email protected]>>
> > > > > .
> > > > > For more options, visit this group at
> > > >
>http://groups.google.com/group/castle-project-users?hl=en.-Hidequotedtext
-
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to
the Google Groups
> > "Castle Project Users" group.
> > To post to this group, send email to
[email protected]
<mailto:[email protected]>
> > .
> > To unsubscribe from this group, send email to
> > [email protected]
<mailto:castle-project-users%[email protected]><castle-project-users%2bun[email protected]
<mailto:[email protected]>>
> > .
> > For more options, visit this group at
>
>http://groups.google.com/group/castle-project-users?hl=en.-
Hide quoted text -
>
> - Show quoted text -
--
You received this message because you are subscribed to the
Google Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:castle-project-users%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the
Google Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.