Create job and calculation objects in a transaction

This pull request fixes https://bugs.launchpad.net/oq-engine/+bug/1227502

Theoretically, it still possible to create an hazard calculation without a job and use that with a risk calculation. In order to avoid that we need a more intrusive refactoring (e.g. remove OqJob).