Question

I am testing EJB 3.1. I have a situation where I need to start a transaction manually in my test, perform some CRUD operations within it (to create some test data which is still not committed) and then call a method in my bean to which the transaction from my test will be propagated.

By default, while using Unitils DatabaseModule, the transactions are automatically created in the test. I understand that it is possible to change this default configuration by modifying unitils.properties as follows,

DatabaseModule.Transactional.value.default=disabled

My question is: Is there a possibility to change this configuration dynamically in the test method? I do not want the transactions to be disabled "always". By default transactions can be "commit", and when required, I want to dynamically set it to "disabled".

-Thanks.

Was it helpful?

Solution

You could try this: https://stackoverflow.com/a/6561782/411229

Not sure if it will work for transaction configuration, but worth a shot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top