In version 2.4.2, when an object in a list is reversed mapped to the owning object, queries are returning objects of types that were not specified in the query.
In the attached example the last test fails because the query returns both TeamA and TeamB objects where only TeamA was specified in query. If the "team" is omitted from the player and targetEntity = Player.class, mappedBy = "team" are removed from Team the query returns the expected result.
TypedQuery<TeamA> query7 = em.createQuery("SELECT t FROM TeamA t JOIN t.squad s where s.name='Mark Wahlberg'", TeamA.class); List<TeamA> q7results = query7.getResultList(); assertEquals(1, q7results.size());
It looks like the result is not filtered properly when the reverseMapping is used.