<No transactional EntityManager found, is your tes...
# stackoverflow
u
No transactional EntityManager found, is your test running in a transactional? I am writing tests for a repository, but BeforeAll annotation causes java.lang.IllegalStateException: No transactional EntityManager found, is your test running in a transactional? error. If I change it to BeforeEach the tests work, but that's not very efficient, since the same record is repeatedly written into the database. How can I fix this? My test class: @DataJpaTest @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ActiveProfiles("testing") class RepositoryTest { @Autowired...