JoinTable and Where annotations lead to "More than one row with the given identifier was found"

Description

Starting from Hibernate 4.3.0 it is unable to load collections mapped as follows:

Key part of this is SecondEntity.guid not being an @Id.

While loading this collection Hibernate issues additional query that looks like this:

For some reason this query neither contains proper entity ID nor condition from @Where annotation thus it produces HibernateException: More than one row with the given identifier was found.

I`m inculding complete example that reproduces this behaviour.
Just setup your DB connection in pom.xml and execute script.sql to create appropriate schema/data.

P.S. Issue seems to be exactly the same with @OneToMany instead of @ManyToMany.

Environment

Hibernate 4.3.0 and later. OS Win7 x64

Assignee

Gail Badner

Reporter

Vasily Muzychenko

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