FETCH JOIN with DISTINCT returns duplicate values

Description

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

Environment

Windows XPSP2, Hibernate 3.1rc2, JDK 5.0_05, MySQL 5.0.13 / PostgreSQL 8.1beta3

Status

Assignee

Unassigned

Reporter

Juergen Zimmermann

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.1 rc2

Priority

Major
Configure