Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 Spring + Maven + JPA (Hibernate) 的系统。我使用 Junit 和 DBUnit。我有一个生成 id 的实体:在测试期间它不会重置序列。我该如何解决这个问题?
您可以尝试以下方法:
@Before public void resetSequence() { // run sql to reset the sequence. // for DB without functionality to reset sequences (eg. oracle) you can try dropping and re-creating the sequence }
序列将在每次测试前重置。