Make the Transaction a smart pointer living inside of Query.