HHH-18215, HHH-2744 test

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-06-02 15:54:39 +02:00
parent 6435137800
commit 18ec7f178e

View File

@ -23,7 +23,7 @@
annotatedClasses = { NativeQuerySchemaPlaceholderTest.TestEntity.class } annotatedClasses = { NativeQuerySchemaPlaceholderTest.TestEntity.class }
) )
@SessionFactory @SessionFactory
@TestForIssue(jiraKey = "HHH-15269") @TestForIssue(jiraKey = {"HHH-15269", "HHH-18215"})
public class NativeQuerySchemaPlaceholderTest { public class NativeQuerySchemaPlaceholderTest {
@BeforeEach @BeforeEach
@ -55,7 +55,6 @@ public void testUpdate(SessionFactoryScope scope) {
nativeQuery.executeUpdate(); nativeQuery.executeUpdate();
} }
); );
scope.inTransaction( scope.inTransaction(
session -> { session -> {
List<TestEntity> testEntities = session.createQuery( "from TestEntity", TestEntity.class ) List<TestEntity> testEntities = session.createQuery( "from TestEntity", TestEntity.class )
@ -64,6 +63,23 @@ public void testUpdate(SessionFactoryScope scope) {
assertThat( testEntity.name, is( "updated_test" ) ); assertThat( testEntity.name, is( "updated_test" ) );
} }
); );
scope.inTransaction(
session -> {
NativeQueryImplementor<Tuple> nativeQuery = session.createNativeQuery(
"UPDATE {h-schema}TestEntity SET name = '{updated_test'"
);
nativeQuery.executeUpdate();
}
);
scope.inTransaction(
session -> {
List<TestEntity> testEntities = session.createQuery( "from TestEntity", TestEntity.class )
.list();
TestEntity testEntity = testEntities.get( 0 );
assertThat( testEntity.name, is( "{updated_test" ) );
}
);
} }
@Test @Test