Menu

#399 IdentityInsertOperation error with MS SQL Server

v2.5.*
closed-duplicate
None
(not fixed)
5
2017-04-02
2017-03-24
Dayan Costa
No

When using the MicrosoftSqlDatabaseOperationLookup to perform tests using MS SQL Server, the transaction is commited and leave the database with durty data. I had to overwrite the class to fix this problem. The problem occurs at line 231, in method execute, just removing the instruction below the problem is solved

jdbcConnection.commit();

Discussion

  • Jeff Jensen

    Jeff Jensen - 2017-03-26

    Thank you for the report.

    Since you have a test that shows this problem, can you make a test for dbUnit that exhibits the problem? Then I can commit it with the change, providing some confidence and regression.

     
    • Dayan Costa

      Dayan Costa - 2017-03-26

      I'll do this and print the dirty data on database and the test results, is it fine?

       
      • Jeff Jensen

        Jeff Jensen - 2017-03-26

        Great, thank you!
        The test can log anything you want to show us data, however tests must have asserts that fail based on conditions that show what the problem is. Otherwise, the test does not become a regression test for future changes. If the test can log the actual data, then it can compare it to the expected data.

         
  • Jeff Jensen

    Jeff Jensen - 2017-03-26
    • status: open --> pending
    • assigned_to: Jeff Jensen
     
  • Dayan Costa

    Dayan Costa - 2017-03-27

    I have uploaded the screenshots in a .zip file on my google drive's account, the link is:
    https://drive.google.com/open?id=0BzUbi3tiuhCdWC1SVVA3UjRaZGM
    I think it's fine.

     
  • Jeff Jensen

    Jeff Jensen - 2017-03-27

    Thanks. You are using "Spring DbUnit" classes and annotations in your work, and those are not part of this product (it uses dbUnit).

    Is the issue with a class in dbUnit or the other product?

    If the issue is in dbUnit, to fix it, please narrow the work to only classes from this project.

     
  • Dayan Costa

    Dayan Costa - 2017-03-27

    The issue is with InsertIdentityOperation and it's located on org.dbunit.ext.mssql
    As I've said, when I use the class from Spring DbUnit that uses this InsertIdentityOperation, from dbUnit, that class performs an commit on currently transaction so Spring is not able to rollback the commited transaction, I've done a test overwritting the class InsertIdentityOperation removing the line wich commits transaction and that problem does not occours anymore.

     
    • Jeff Jensen

      Jeff Jensen - 2017-03-27

      This is the first you mentioned Spring DbUnit.
      Closing this, feel free to reopen if you find an issue with dbUnit itself. And transaction rollback in tests is not a good idea.

       
  • Jeff Jensen

    Jeff Jensen - 2017-03-27
    • status: pending --> closed-rejected
     
  • Dayan Costa

    Dayan Costa - 2017-03-27

    Why isn't it a good idea to rollback transactions in tests? I'm doing unit tests. What do you recommend to these cases?

     
  • Jeff Jensen

    Jeff Jensen - 2017-04-02
    • status: closed-rejected --> closed-duplicate
     
  • Jeff Jensen

    Jeff Jensen - 2017-04-02

    Duplicate of #309, just committed.

     

Log in to post a comment.

MongoDB Logo MongoDB