/** Called dummyPKs because they can be invalid PKs, doing a deleteByAnd instead of a normal delete */ public int deleteAll(List dummyPKs) throws GenericEntityException { if (dummyPKs == null || dummyPKs.size() == 0) { return 0; } SQLProcessor sqlP = new ExplcitCommitSQLProcessor(helperName); try { Iterator iter = dummyPKs.iterator(); int numDeleted = 0; while (iter.hasNext()) { GenericEntity entity = (GenericEntity) iter.next(); // if it contains a complete primary key, delete the one, otherwise deleteByAnd if (entity.containsPrimaryKey()) { numDeleted += delete(entity, sqlP.getConnection()); } else { numDeleted += deleteByAnd(entity.getModelEntity(), entity.getAllFields(), sqlP.getConnection()); } } return numDeleted; } catch (GenericDataSourceException e) { sqlP.rollback(); throw new GenericDataSourceException("Generic Entity Exception occurred in deleteAll", e); } finally { sqlP.close(); } }
/** Called dummyPKs because they can be invalid PKs, doing a deleteByAnd instead of a normal delete */ public int deleteAll(List dummyPKs) throws GenericEntityException { if (dummyPKs == null || dummyPKs.size() == 0) { return 0; } SQLProcessor sqlP = new ExplcitCommitSQLProcessor(helperName); try { Iterator iter = dummyPKs.iterator(); int numDeleted = 0; while (iter.hasNext()) { GenericEntity entity = (GenericEntity) iter.next(); // if it contains a complete primary key, delete the one, otherwise deleteByAnd if (entity.containsPrimaryKey()) { numDeleted += delete(entity, sqlP.getConnection()); } else { numDeleted += deleteByAnd(entity.getModelEntity(), entity.getAllFields(), sqlP.getConnection()); } } return numDeleted; } catch (GenericDataSourceException e) { sqlP.rollback(); throw new GenericDataSourceException("Generic Entity Exception occurred in deleteAll", e); } finally { sqlP.close(); } }
/** * Called dummyPKs because they can be invalid PKs, doing a deleteByAnd instead of a normal delete */ public int deleteAll(List<? extends GenericEntity> dummyPKs) throws GenericEntityException { if (dummyPKs == null || dummyPKs.size() == 0) { return 0; } SQLProcessor sqlP = new ExplicitCommitSQLProcessor(helperName); try { Iterator<? extends GenericEntity> iter = dummyPKs.iterator(); int numDeleted = 0; while (iter.hasNext()) { GenericEntity entity = iter.next(); // if it contains a complete primary key, delete the one, otherwise deleteByAnd if (entity.containsPrimaryKey()) { numDeleted += deleteImpl(entity, sqlP.getConnection()); } else { numDeleted += deleteByAnd(entity.getModelEntity(), entity.getAllFields(), sqlP.getConnection()); } } return numDeleted; } catch (GenericDataSourceException e) { sqlP.rollback(); throw new GenericDataSourceException("Generic Entity Exception occurred in deleteAll", e); } finally { closeSafely(dummyPKs, sqlP); } }