Im having a problem with a major data migration that can be configured by the user, lets say it goes like this:
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();
}
My problem is that when the IndexDuplicityException is throwed, any of the future transactions are ignored, giving me this exception
PSQLException: current transaction is aborted, commands ignored until end of transaction block
Isnt there a way to my transaction allow failed excecuted statements and not abort the whole transaction?
Thanks.