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
|