0
比方說,我有一個類A
(與表tbl_a
映射)和一個類B
(映射表tbl_b
)。例如,這兩個類(表)具有關係OneToMany
的關係。 類B
也與另一個類C
(表tbl_c
)有關係。例如,該關係也是OneToMany
。 我通過Hibernate Criteria在表tbl_a
上查詢(選擇查詢)。當我在控制檯中檢查休眠生成的SQL時,我看到類A
,類B
,甚至類C
的所有屬性。 即使一切運行良好,查詢也很大,選擇所有這些屬性(列)可能會影響性能。 我不希望類B
和C
的所有屬性。我只想要類A
的屬性。 在Hibernate中是否有配置,不選擇相關表的所有屬性? 注意:使用默認的Lazy
fetchType。瞭解由休眠生成的sql查詢
讀了大約一個叫預先加載的東西:-)通常情況下,表將只有當你要求他們加載。除非你將它們標記爲急切加載。 通常急切的加載雖然更好,性能明智,但不記憶明智。 – Tschallacka