There's an unexpected behavior with composite keys mapped with @Id and Many-To-Many associations mapped as 2 Many-To-Ones.
I've create a test case:
Have a look at the entities: https://github.com/michael-simons/possible_hibernate_426_bug_with_date/tree/master/src/main/java/entities
A1 < AB1 > B1
and the same with "2".
Ax has a composite key that also references another Entity foobar which is - i hope - jpa conform. Please ignore that on MySQL the primary key is only defined as id, i wanted to use an auto-increment for id.
The only difference from the mappings is the naming of the id attribute in Ax.
In A1 it's called "id" and in A2 it's called "a2id".
When i run https://github.com/michael-simons/possible_hibernate_426_bug_with_date/blob/master/src/test/java/tests/IdColumnNamesTest.java the CriteriaQuery with a subquery (all Ax's that have a Bx) fails for the "1" entities with
"Caused by: java.sql.SQLException: Operand should contain 2 column(s)" on mysql and with
"SqlNode's text did not reference expected number of columns" on Oracle.
The A2 case where id has a different name works as expected (with the correct results in production).