我有两个表,first_table
和second_table
,我正在加入这些表。 second_table包含与记录表的@OneToMany关系。此关系标记为FetchType.Lazy。当我在下面运行查询时,出现此异常,表明无法识别FETCH
org.hibernate.exception.SQLGrammarException: could not execute query
...
SELECT *
FROM first_table f
LEFT OUTER JOIN second_table s ON f.id = s.id
JOIN FETCH[*] second_table.records
...
JPARepository本机查询
SELECT *
FROM first_table f
LEFT OUTER JOIN second_table s ON f.id = s.id
JOIN FETCH second_table.records