These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Why is it so slow?
PostPosted: Tue Oct 23, 2007 8:16 am 
Newbie

Joined: Tue Oct 23, 2007 6:41 am
Posts: 6
Hi all,

I'm evaluating NHibernet, so I've created simple aplication. I have two objects with parent-child relation, with mapping:


Parent:

<class name="NHibernateTest.Data.Parent, NHibernateTest" table="tbl_parent">
<cache usage="read-write"/>

<!-- ID -->
<id name="id" type="long" column="id" unsaved-value="-1">
<generator class="identity" />
</id>

... some other properties

<!-- Children -->
<set name="ChildList"
inverse="true"
lazy="true"
cascade="all">
<cache usage="read-write"/>
<key column="stat_id"/>
<one-to-many class="NHibernateTest.Data.Child, NHibernateTest"/>
</set>
</class>

Child:

<class name="NHibernateTest.Data.Psc, NHibernateTest" table="tbl_child">
<cache usage="read-write"/>

<!-- ID -->
<id name="id" type="long" column="id" unsaved-value="-1">
<generator class="identity" />
</id>

... some other properties

<many-to-one name="Parent"
column="parent_id"
not-null="true"
class="NHibernateTest.Data.Parent, NHibernateTest"/>
</class>


I run import from xml as test: there were 1 parent and 3000 children. The import takes 173 sec! The same example with ADO takes only 11 sec.

I understand that NHibernate must be slower then direct ADO because a lot of features and so on but on my test with NH is 15 times slower :-(

Have I something wrong or it is common behaviour of NHibernate?

If somebody is interested in I can post my test project.

Thanks for your help!

Smoke


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 23, 2007 9:03 am 
Regular
Regular

Joined: Thu Nov 23, 2006 10:29 am
Posts: 106
Location: Belgium
Yes, it would be handy to have the whole project or at least some more code.

_________________
Please rate this post if it helped.

X.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 23, 2007 9:26 am 
Newbie

Joined: Tue Oct 23, 2007 6:41 am
Posts: 6
My testing project could be downloaded from http://mmatus.atlasweb.cz/NHibernateTest.zip

Smoke


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 24, 2007 10:06 am 
Regular
Regular

Joined: Thu Nov 23, 2006 10:29 am
Posts: 106
Location: Belgium
Hi,

I was about to write that I am as baffled as you are, until I noticed a difference in your connection string.
For the 'direct' connection, you added 'OLE DB Services=-1;' to the connection string while this was not the case for NHibernate.

When adding 'OLE DB Services=-1;' to the NHibernate connection string (making it exactly the same as the 'direct' connection), the import with NHibernate 'only' takes 25 secs.

_________________
Please rate this post if it helped.

X.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 1:41 am 
Newbie

Joined: Tue Oct 23, 2007 6:41 am
Posts: 6
Oups! It was my stupid mistake!

Thank you very much for your help! :-)

Smoke


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.