public Object doInPersistenceBroker(PersistenceBroker pb) throws PersistenceBrokerException { pb.delete(entity); return null; } });
public Object doInPersistenceBroker(PersistenceBroker pb) throws PersistenceBrokerException { pb.delete(entity); return null; } });
public Object doInPersistenceBroker(PersistenceBroker pb) throws PersistenceBrokerException { pb.delete(entity); return null; } });
broker.delete(tmpObj); } else { logger.error("Attempt to delete non-Persistable object instance from RDBMS!");
/** * This method deletes a Persistable from persistent store. * * @param objectToDelete Persistable to delete * @throws IllegalArgumentException If an attempt is made to delete an object that does not implement the Persistable interface * @throws PersistenceException Throws exception if called on null broker or if an error occurred in the delete process */ protected void deleteObject(final Object objectToDelete) throws PersistenceException, IllegalArgumentException { if (broker != null) { try { if (objectToDelete instanceof Persistable) { beginTransaction(); broker.delete(objectToDelete); commitTransaction(); } else { logger.error("Attempt to delete non-Persistable bean instance from RDBMS!"); throw new IllegalArgumentException("Only Persistable instances can be deleted, since these are the only implementations that are persistence-aware!"); } } catch (PersistenceBrokerException pbe) { // If something went wrong: rollback logger.error("Unable to delete instance '" + Persistable.class.getName() + "' from RDBMS: " + pbe.getMessage(), pbe); rollbackTransaction(); throw new PersistenceException("Unable to delete instance '" + Persistable.class.getName() + "' from RDBMS: " + pbe.getMessage(), pbe); } } else { throw new PersistenceException("DeleteObject called on null broker"); } }