dbunit处理auto_increment数据问题

来源:互联网 发布:linux 查看命令行历史 编辑:程序博客网 时间:2024/06/05 11:27
使用dbunit的目的是消除对数据库的影响,但是在实际使用过程中发现,对于auto_increment的数据,dbunit不会还原到备份之前。
 因此,我们在还原之前应该首先truncate掉所有的数据库表,然后在执行还原操作。


 操作:DatabaseOperation.TRUNCATE_TABLE.execute(this.dbconn, restoreDataSet);

              DatabaseOperation.CLEAN_INSERT.execute(this.dbconn, restoreDataSet);


引用:

http://ronghantao.blog.163.com/blog/static/1862932652011827713557/

http://jasalguero.com/ledld/development/dbunit-truncate-data-or-not/