Hi John,
Thanks for the reply. As I've said, its a very simple entity with just
an id and description. It doesnt have any child collections or
anything. I've also checked within sql and the generated sql
statements of nhibernate and there's only 1 select statement being
executed and it runs very fast. The performance issue happens when I
try to loop through the list that NHibernate produces to transform it
to a DTO object. Note that no additional SQL statements are being run
because the entity does not have any child collections so I'm sure its
not an issue with lazy loading.
//Entity
Public class MyEntity
{
public Guid Id {get;set;}
public string Description {get;set;}
}
//Map File
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="Test.Domain"
assembly="Test" >
<class name="Product">
<id name="Id">
<generator class="guid" />
</id>
<property name="Description" />
</class>
</hibernate-mapping>
Regards,
Aldrich
On Apr 24, 10:22 pm, John Davidson <[email protected]> wrote:
> If you provide the mappings we can give more detailed advice, but most
> likely it is because you are querying child collections as you iterate the
> list. A tool like NHProf will let you see what is going on.
>
> John Davidson
>
>
>
> On Sun, Apr 24, 2011 at 6:31 AM, aldrich12 <[email protected]> wrote:
> > I have a very simple entity with just an id and a description.
> > When i try to do a criteria.List<MyEntity>() and then loop through
> > that list to transform it to a DTO object, it takes a considerably
> > long time compared to entity framework or using a datareader. Looping
> > through the Nhibernate list takes about 8 seconds for just 2000+
> > records unlike for entity framework its instantaneous.
>
> > I've tried settings flushmode to never, clearing out the session but
> > it doesn't affect the performance. Can anybody here shed some light as
> > to why this is happening?
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -
--
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.