You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can also use the static methods in your test method, but it's more complex because Hibernate will try to delay the flush of your entities states at the end of your application transaction,
35
+
36
+
Here we call flush manually:
37
+
38
+
@Test
39
+
@Transactional
40
+
void create_two_entities() {
41
+
BlogPost post_1 = new BlogPost("Post title 1");
42
+
blogPostRepository.save(post_1);
43
+
entityManager.flush();
44
+
assertInsertStatementCount(1);
45
+
46
+
BlogPost post_2 = new BlogPost("Post title 2");
47
+
blogPostRepository.save(post_2);
48
+
entityManager.flush();
49
+
assertInsertStatementCount(2);
50
+
}
33
51
34
52
## How to integrate
35
53
- Register the integration with Hibernate, you just need to add this key in your configuration (here for yml):
0 commit comments