I believe Get always goes to the database, Load returns a proxy. On Thu, Mar 12, 2009 at 4:15 PM, Jay Chapman <[email protected]> wrote:
> How do you know the select statement that NHibernate used? Were you using > a profiler? Did you log NHibernate's sql. NHibernate doesn't do anything > special that would cause the query itself to be slow. If you're getting a > timeout it's a sql timeout. I'm guessing the actual query is different, and > is probably trying to load other related objects where maybe something is > misconfigured. > If you're using the default configuration (proxy) for objects, I do not > even think that method you say you called will go to the database. It'll > just return a proxy. Has that changed in a recent version? > > On Thu, Mar 12, 2009 at 4:26 AM, Levin <[email protected]> wrote: > >> >> Hi, >> I'm a newbie to NHibernate,today i try to fetch a record from a >> large table using NHibernate. >> My table has a primary key of string type,and currently has more >> than 1000000 records. >> >> I tryed: >> session.Get<PackingSlip>("xxx"); >> >> NH executed the sql "Select .... from PackingSlips where id='xxx' >> against my db,but it's very very slow,always complained 'timeout'. >> >> If i execute the same sql directly on the ms sql management >> studio,it's done immediately(maybe less than 0.1 second). >> >> Can somebody tell me why?Thanks so much! >> >> BTW:My NH version is 2.1GA >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
