w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Junit is successful when use session.save but not inserting data in MySQL database tables eventhough i tried with flush the session as well

By default, @Transactional tests will roll-back all changes when the test method completes. So even if the test passes, the changes are only valid for the current running Transaction. To persist your changes, you need to commit the transaction.

Check out the example on this SO question.

You can replace @Transactional with transactionTemplate to commit the transaction prior to finishing a test.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.