Skip to content

shihyuho/hibernate-join-fetch-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hibernate Join, Fetch Issue

相關 Cases

  • HHH-17629: Criteria and Entity graph generates same join clause twice
  • HHH-18378: Avoid reusing existing joins for entity-graph fetches if they're included in the where clause
  • HHH-19095: Re-use existing compatible joins for fetch if not used in where clause (此為優化建議, 尚未實作)

測試案例

  1. 同時呼叫 join 及 fetch, 但 where 條件至多一個
  2. 同時呼叫 join 及 fetch, 但指定兩個 where 條件

Summary

  1. 對相同的欄位同時下 fetch 跟 join, 不會 reuse, 會產生多次 join 語句
  2. 產生的 join 語句, 會依照呼叫 root.fetch(...)root.join(...) 方法的順序來產生
  3. fetch 跟 join 所指定的 where 條件, 不論條件有沒有一樣, 都不會 reuse, 且會依照呼叫方法的順序來產生 where 語句
  4. 若呼叫 root.join(...) 先於 root.fetch(...), 產生的 where 語句會 "reuse" 使用 join 的來過濾

Note

第4點, 不確定是否是新的 bug, 或者是 hibernate 的優化項目, 但這跟 HHH-19095 有點關聯

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages