LoginSignup
6
6

More than 5 years have passed since last update.

DBUnit 実行前にシーケンスをリセットする

Posted at
  • connect()で IDatabaseConnectionを取得出来る前提
  • postgresの場合。DBに応じて都度いい感じにクエリを変える
connect()
.getConnection()
.createStatement()
.executeQuery("select setval('" + sequenceName + "', (select max(" + columnName + ") from " + tableName + "))");

適宜 @Before などで呼ぶ

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6