When I make a fetch join (left outer join with FETCH clause) I get duplicated return values even when I specify DISTINCT. Without the FETCH keyword no duplicates are returned.
Examples (see attached test case):
SELECT DISTINCT c.id FROM CustomerData c LEFT JOIN FETCH c.orders o WHERE c.name = 'Alpha' AND o.id > 0
SELECT DISTINCT c.id FROM CustomerData c LEFT JOIN c.orders o WHERE c.name = 'Alpha' AND o.id > 0
JAR files are not uploaded due to upload restrictions of my proxy server: commons logging, db driver, hibernate jars
Windows XPSP2, Hibernate 3.1rc2, JDK 5.0_05, MySQL 5.0.13 / PostgreSQL 8.1beta3
This is expected and documented. Outer-join results contain duplicates, Hibernate passes them on. Put your result in a HashSet to make it distinct. Use the forum next time before posting a bug report.
Closing stale resolved issues