HHH-18218 - Added test case not using explicit constructor new ConstructorDto(...)

This commit is contained in:
Cedomir Igaly 2024-06-12 11:22:56 +02:00 committed by Christian Beikov
parent 742fc4c60a
commit f63f15bb4f
1 changed files with 9 additions and 0 deletions

View File

@ -45,6 +45,15 @@ public class InstantiationWithGenericsTest {
.containsExactly( 1L, "entity_1" ) );
}
@Test
public void testImplicitConstructor(SessionFactoryScope scope) {
scope.inTransaction( session -> assertThat( session.createQuery(
"select e.id, e.data from ConcreteEntity e",
ConstructorDto.class
).getSingleResult() ).extracting( ConstructorDto::getId, ConstructorDto::getData )
.containsExactly( 1L, "entity_1" ) );
}
@Test
public void testInjection(SessionFactoryScope scope) {
scope.inTransaction( session -> assertThat( session.createQuery(