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