55import org .hibernate .testing .orm .junit .JiraKey ;
66import org .hibernate .testing .orm .junit .EntityManagerFactoryScope ;
77import org .hibernate .testing .orm .junit .Jpa ;
8+ import org .junit .jupiter .api .AfterAll ;
89import org .junit .jupiter .api .BeforeAll ;
910import org .junit .jupiter .api .Test ;
1011
1112import jakarta .persistence .Entity ;
1213import jakarta .persistence .Id ;
13- import jakarta .persistence .NamedNativeQuery ;
1414import jakarta .persistence .Query ;
1515import jakarta .persistence .Table ;
1616
@@ -32,16 +32,23 @@ public void setUp(EntityManagerFactoryScope scope) {
3232 Query query = entityManager .createNativeQuery ( QUERY );
3333 scope .getEntityManagerFactory ().addNamedQuery ( "ENTITY_BY_NAME" , query );
3434
35- TestEntity entity = new TestEntity ( 1l , "And" , 1 );
36- TestEntity entity2 = new TestEntity ( 2l , "Fab" , 2 );
35+ TestEntity entity = new TestEntity ( 1L , "And" , 1 );
36+ TestEntity entity2 = new TestEntity ( 2L , "Fab" , 2 );
3737 entityManager .persist ( entity );
3838 entityManager .persist ( entity2 );
3939 }
4040 );
4141 }
4242
43+ @ AfterAll
44+ public void tearDown (EntityManagerFactoryScope scope ) {
45+ scope .inTransaction (
46+ entityManager -> entityManager .createQuery ( "delete from TestEntity" ).executeUpdate ()
47+ );
48+ }
49+
4350 @ Test
44- public void testExecuteNativQuery (EntityManagerFactoryScope scope ) {
51+ public void testExecuteNativeQuery (EntityManagerFactoryScope scope ) {
4552 scope .inTransaction (
4653 entityManager -> {
4754 Query query = entityManager .createNamedQuery ( QUERY_NAME );
0 commit comments