Hibernate version:
3.2
Table Urls contains urls, GzHtml the corresponding fetched HTML and GzText basicly the HTML with stripped off tags etc.
Find records in GzHtml which don't yet exist in GzText:
SQL:
Code:
SELECT id, url, htmlFROM
(
SELECT url_id, html FROM gzhtml WHERE url_id NOT IN
(
SELECT url_id FROM gztext
)
) AS diff
INNER JOIN urls ON diff.url_id = urls.id;
HQL:
Code:
FROM Urls u JOIN FETCH u.gzHtml h WHERE u.id = h.urlId AND u.id NOT IN (SELECT urlId FROM GzText)
At least both return the same result count n but the HQL version load n times a GzText (?!) entity. Why is that and esp. what is it loading? These n GzText records are actually *missing* in GzText.