林與可由用戶配置的主要數據遷移,可以說,它是這樣的:交易允許失敗,並繼續有問題
try {
daoManager.beginTransaction();
for (Entity node : nodeList) {
boolean inserted;
if (migrationConfig.canInsert()) {
try {
inserted = daoManager.getDaoEntity().insert(node);
}
catch(IndexDuplicityException ex) {
inserted = false;
//I want the transaction to continues when this Exceptions is
//throwed
}
}
if (migrationConfig.canUpdate() && !inserted) {
modificoEntidad = daoManager.getDaoEntity().update(node);
}
}
//Later
if (//Business Logic) {
throw new MustRollBackTransaction();
}
daoManager.commitTransaction();
} catch (MustRollBackTransaction ex) {
daoManager.RollBack();
}
我的問題是,當IndexDuplicityException被倒掉,任何未來的交易將被忽略,給我這個例外
PSQLException:忽略當前事務被中止,命令,直到事務塊 結束
沒有辦法讓我的交易允許失敗的excecuted語句,而不是中止整個交易?
謝謝。
不支持Postgres的異常表?這可能會抑制將事務標記爲僅回滾的異常。 – Nicholas 2014-11-05 11:38:39
@尼古拉斯你能解釋一下嗎? – leomcpugo 2014-11-06 15:42:08