Hibernate H2 specify drop table order

后端 未结 2 1258
天涯浪人
天涯浪人 2021-01-06 02:42

I have pretty much the same problem like this user. Hibernate can\'t drop the tables of my in-memory test database after each SpringBootTest (e.g. when running mvn test). Th

2条回答
  •  走了就别回头了
    2021-01-06 03:48

    You must annotate your test classes with DirtiesContext:

    @DirtiesContext(methodMode = MethodMode.BEFORE_CLASS)
    

    This will rebuild the test context and therefore also create-drop your schema.

    Read more about this: https://www.baeldung.com/spring-dirtiescontext

提交回复
热议问题