通常,玩! commits the transaction after a request completes successfully。 在Play中手動提交交易的正確方法是什麼?我怎樣才能玩一玩! JPA手動交易?
void addPerson() {
Person p = new Person("John", "Doe");
p.save();
// TODO - commit the transaction
// Now p should have an ID
assert p.id != null;
usePersonIdForSomethingNasty(p.id);
}
調試,我發現p有一個ID甚至在交易提交之前。我不知道如何。 – ripper234
http://stackoverflow.com/questions/8169640/how-does-an-entity-get-an-id-before-a-transaction-is-committed-in-jpa-play – ripper234