1
배치 크기가 nHibernate (C# - VS 2012)에서 발생했습니다. "batch-size"를 컬렉션 및 구성에 설정했지만 작동하지 않습니다.nHibernate 배치 크기가 작동하지 않습니다.
using (var s = OpenSession())
{
using (var t = s.BeginTransaction())
{
Parent parent = s.CreateCriteria(typeof(Parent)).List<Parent>().First();
Console.Write(parent.Children[0]);
t.Commit();
}
}
nHibernate 수 프로파일 러는 (예를 들어 1000 어린이를) 한 번에 모든 아이들이 소요 보여 주지만 그것은 단지 5
Parent.hbm.xml을해야합니다
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="L6.Model" assembly="L6">
<class name="Parent">
<id name="ParentId">
<generator class="native" />
</id>
<bag name="Children" batch-size="5">
<key column="ID_Parent"/>
<one-to-many class="Child"/>
</bag>
</class>
</hibernate-mapping>
아이. hbm.xml :
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="L6.Model" assembly="L6">
<class name="Child">
<id name="ChildId">
<generator class="native" />
</id>
<many-to-one name="Parent" column="ID_Parent" class="Parent" />
</class>
</hibernate-mapping>
있는 hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<!-- This is the System.Data.dll provider for SQL Server -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">
Server=.;initial catalog=Lista6;Integrated Security=SSPI
</property>
<property name="adonet.batch_size">5</property>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="generate_statistics">true</property>
<mapping file="Child.hbm.xml" />
<mapping file="Parent.hbm.xml" />
</session-factory>
</hibernate-configuration>
배치 크기가 작동하지 않는 이유가 있습니까?
설명 주셔서 감사합니다. –