Steve Chambers Steve Chambers - 1 year ago 204
Java Question

Why is @Transactional(Propagation.NOT_SUPPORTED) not working as expected?

Given the following:

  1. An integration test is started using
    at class level.

  2. Some reference data is inserted with
    specified at method level.

  3. A service method marked as
    attempts to look up some reference data inserted in step 2.

The service method can't see the reference data!

My understanding was that if data is inserted outside the transaction, it would be instantly accessible to another method whether it is inside or outside the transaction. Could anyone explain?

Answer Source

Not a complete answer but I think these woes are partially caused by running integration tests inside an overarching transaction - this article explains why this is a bad idea. Am going to attempt to rewrite all the data population to be non-transactional and cleared up manually at the end of each test.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download