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
1 changed files with 18 additions and 2 deletions

View File

@ -23,7 +23,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
annotatedClasses = { NativeQuerySchemaPlaceholderTest.TestEntity.class }
)
@SessionFactory
@TestForIssue(jiraKey = "HHH-15269")
@TestForIssue(jiraKey = {"HHH-15269", "HHH-18215"})
public class NativeQuerySchemaPlaceholderTest {
@BeforeEach
@ -55,7 +55,6 @@ public class NativeQuerySchemaPlaceholderTest {
nativeQuery.executeUpdate();
}
);
scope.inTransaction(
session -> {
List<TestEntity> testEntities = session.createQuery( "from TestEntity", TestEntity.class )
@ -64,6 +63,23 @@ public class NativeQuerySchemaPlaceholderTest {
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