Illegal SQL generated for count distinct queries of embeddables

Description

the following query generates illegal SQL if the entity uses an embeddable as primary key:

This is just the simplest example for such a query. In reality the query is much more complicated and involves left joins (the reason for the distinct). It does not matter whether this is done in JPQL or as a criteria query.
The generated SQL is not legal in Oracle:

Trying to reformulate as e.g. distinct concat(field1,field2) fails in HQL. For Oracle in particular the correct SQL should probably look more like:

Environment

Hibernate 4.3.7 and 4.3.10 / Oracle 11g

Assignee

Unassigned

Reporter

Jürg Wanner

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure