java - What is the difference between select and subselect in Hibernate's fetch attribute? Are there any usage scenarios?
高洛峰
高洛峰 2017-05-17 10:03:48
0
1
493

As mentioned, thank you for your advice

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
为情所困
  • SUBSELECT: avoids N+1 and does not duplicate data, but loads all entities of related types into memory.

FetchMode.SUBSELECT should look like this:

SELECT <employees columns>
FROM EMPLOYEE employees0_
WHERE employees0_.DEPARTMENT_ID IN
(SELECT department0_.DEPARTMENT_ID FROM DEPARTMENT department0_)

FetchMode.SUBSELECT can significantly reduce the number of queries

I found a very good article

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template