| Given two entities named Person and Phone with a oneToMany relationship; And database is seed with one Person with two Phones; When we try to select all persons with specific columns from each entities, like in query below:
session.createQuery("select distinct p.id, ph.number from Person p left join p.phones ph" )
.getResultList();
Then we get two Person (one for each Phone) entities instead of one, see attached image. Full test case can be found here: https://github.com/rmpestano/hibernate-test-case-templates/blob/master/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMUnitTestCase.java |