0
我在多對多的延遲加載中遇到問題。沒有例外,數據庫中有行,但延遲加載返回0行。你知道爲什麼嗎?多對多返回無數據
映射:
<class name="Riesitel" table="riesitel" lazy="true" >
<composite-id>
<key-many-to-one lazy="false" name="os_udaje">
<column name="os_cislo" sql-type="integer" not-null="true" />
</key-many-to-one>
<key-many-to-one lazy="false" name="projekt_etapa">
<column name="rok" not-null="true" />
<column name="id_projektu" not-null="true" />
<column name="id_fakulty" not-null="true" />
</key-many-to-one>
</composite-id>
<bag name="riesitel_rolas" inverse="true" cascade="none" table="riesitel_rola">
<key>
<column name="os_cislo"/>
<column name="rok"/>
<column name="id_projektu"/>
<column name="id_fakulty"/>
<!-- <column name="id_rola" sql-type="Char"/> -->
</key>
<many-to-many class="Rola_v_projekte">
<column name="id_rola"/>
</many-to-many>
</bag>
<class name="Rola_v_projekte" table="rola_v_projekte" lazy="true" >
<id name="id_rola">
<column name="id_rola" sql-type="integer" not-null="true" />
<generator class="sequence">
<param name="sequence">id_rola_seq</param>
</generator>
</id>
<bag name="riesitel_rolas" inverse="true" cascade="none" table="riesitel_rola">
<key>
<column name="id_rola" />
</key>
<many-to-many class="Riesitel">
<column name="os_cislo"/>
<column name="rok"/>
<column name="id_projektu"/>
<column name="id_fakulty"/>
</many-to-many>
</bag>
DB模式:當我改變我的databese到非複合我認爲這是在NHibernate的錯誤..:
你確定你要連接到數據庫ÿ你以爲你是?你看過nhibernate正在使用的SQL,並且實際上是在它連接的數據庫上運行它嗎? – 2012-02-09 23:24:46
去下載NHProf,這一定會幫助你看看發生了什麼。 – CrazyCoderz 2012-02-10 15:15:33