TokuMx
取引を整理するために使用しています。そのための特定のコマンドがあります。
で走ってみdb.runCommand("beginTransaction")
ましたMongo shell
。うまくいきました。
しかし、私が同じことをしたときJongo
:
PlayJongo.jongo().runCommand("beginTransaction");
それは私にくれました[error] play - Cannot invoke the action, eventually got an error: java.lang.IllegalArgumentException: Cannot parse query: beginTransaction
私は何を間違えましたか?
編集
public static boolean buyProduct(User buyer, User seller, int accountIndex, float productPrice){
boolean isSuccess = false;
PlayJongo.jongo().runCommand("{beginTransaction : 1}");
try{
// Deposit money to seller
seller.getAccounts().get(0).deposit(productPrice);
UserRepository.update(seller);
// Withdraw money from buyer
buyer.getAccounts().get(accountIndex).withdraw(productPrice);
UserRepository.update(buyer);
throw new Exception();
//isSuccess = true;
}
catch (Exception e){
PlayJongo.jongo().runCommand("{rollbackTransaction : 1 }");
isSuccess = false;
}
return isSuccess;
}