我有很多-to-one關聯設置這樣,在你hml.xml:冬眠多到一個HQL查詢,當內部連接獲取財產沒有關聯
<many-to-one name="gigVenue"
class="blah.blah.xxx" fetch="select"
lazy="no-proxy" not-null="true" >
<column name="N_VENUE_ID" precision="18" scale="0" not-null="true" />
</many-to-one>
,我使用儀器做真正的懶加載。
但是,當我運行一個hql查詢與另一個表的內部聯合提取時,應該包含另一個表的值的對象的屬性保留爲空。即使我可以看到其他表的值由hibernate創建的對象。
有沒有人有任何洞察到這個問題?
更新:
from Gig g inner join fetch g.gigVenue gv where g.artistId = :artistId and (g.territoryId = -1 or g.territoryId = :territoryId) order by g.gigDatetime desc
<set name="gigs" inverse="true" lazy="true" table="DSP_GIG" fetch="select">
<key>
<column name="N_VENUE_ID" precision="18" scale="0" not-null="true" />
</key>
<one-to-many class="blah.blah.Gig" />
</set>
你可以發佈實際查詢和第二個映射嗎? – ChssPly76 2009-08-06 07:06:39