HHH-13045 - Testcase showing access of assocation id contained in element collection doesn't work

This commit is contained in:
Christian Beikov 2018-10-18 11:34:41 +02:00 committed by Guillaume Smet
parent 3c5534f23f
commit b202333ff9
1 changed files with 25 additions and 0 deletions

View File

@ -128,6 +128,31 @@ public class EmbeddableCollectionElementWithLazyManyToOneTest extends BaseCoreFu
);
}
@Test
@TestForIssue( jiraKey = "HHH-13045")
public void testAccessIdOfManyToOneInEmbeddable() {
Parent p = new Parent();
p.containedChildren.add( new ContainedChild( new Child() ) );
doInHibernate(
this::sessionFactory, session -> {
session.persist( p );
}
);
doInHibernate(
this::sessionFactory, session -> {
assertFalse( session.createQuery( "from Parent p join p.containedChildren c where c.child.id is not null" ).getResultList().isEmpty() );
}
);
doInHibernate(
this::sessionFactory, session -> {
session.delete( p );
}
);
}
@Entity(name = "Parent")
public static class Parent {
@Id