林与可由用户配置的主要数据迁移,可以说,它是这样的:交易允许失败,并继续有问题
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