5
5
import org .hibernate .testing .orm .junit .JiraKey ;
6
6
import org .hibernate .testing .orm .junit .EntityManagerFactoryScope ;
7
7
import org .hibernate .testing .orm .junit .Jpa ;
8
+ import org .junit .jupiter .api .AfterAll ;
8
9
import org .junit .jupiter .api .BeforeAll ;
9
10
import org .junit .jupiter .api .Test ;
10
11
11
12
import jakarta .persistence .Entity ;
12
13
import jakarta .persistence .Id ;
13
- import jakarta .persistence .NamedNativeQuery ;
14
14
import jakarta .persistence .Query ;
15
15
import jakarta .persistence .Table ;
16
16
@@ -32,16 +32,23 @@ public void setUp(EntityManagerFactoryScope scope) {
32
32
Query query = entityManager .createNativeQuery ( QUERY );
33
33
scope .getEntityManagerFactory ().addNamedQuery ( "ENTITY_BY_NAME" , query );
34
34
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 );
37
37
entityManager .persist ( entity );
38
38
entityManager .persist ( entity2 );
39
39
}
40
40
);
41
41
}
42
42
43
+ @ AfterAll
44
+ public void tearDown (EntityManagerFactoryScope scope ) {
45
+ scope .inTransaction (
46
+ entityManager -> entityManager .createQuery ( "delete from TestEntity" ).executeUpdate ()
47
+ );
48
+ }
49
+
43
50
@ Test
44
- public void testExecuteNativQuery (EntityManagerFactoryScope scope ) {
51
+ public void testExecuteNativeQuery (EntityManagerFactoryScope scope ) {
45
52
scope .inTransaction (
46
53
entityManager -> {
47
54
Query query = entityManager .createNamedQuery ( QUERY_NAME );
0 commit comments