candlepin/candlepin — pull request #707 by dgoodwin (2014-09-02 17:18:44+00:00)
Title: Request Transactions

Original intention of the API was for a request to either fail or succeed, and never make partial changes to the DB. Over time this has been lost most likely with inconsistent use of where the transactional annotation is applied.

To remedy we will use an interceptor/invoker to automatically initiate a transaction on every REST API method. Use of Transactional lower in the call stack will no-op as Guice always re-uses an open transaction rather than starting a new one.

Also included is an annotation for NonTransactional to avoid this behaviour, which is required in one specific location where we import manifests, but want to record that the import failed. The error handling around this API call is extremely delicate so left alone for now.

Also fixed a bug exposed by the change where we modified a Hibernate object for display purposes to hide information, which started being persisted to the DB once wrapped in a transaction.