| Starting from Hibernate 4.3.0 it is unable to load collections mapped as follows:
@ManyToMany
@JoinTable(
name = "FirstEntity_SecondEntity",
joinColumns = @JoinColumn(name = "firstEntity_uuid"),
inverseJoinColumns = @JoinColumn(name = "secondEntity_guid", referencedColumnName = "guid"))
@Where(clause = "isLast = 1")
private Set<SecondEntity> secondEntities;
While loading this collection Hibernate issues additional query that looks like this:
SELECT
secondenti0_.uuid AS uuid1_2_0_,
secondenti0_.guid AS guid2_2_0_,
secondenti0_.isLast AS isLast3_2_0_
FROM SecondEntity secondenti0_
WHERE secondenti0_.guid = ?
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. |