} catch (PersistenceBrokerException pbe) { logger.error("Unable to store collection to RDBMS: " + pbe.getMessage(), pbe); rollbackTransaction(); throw new PersistenceException("Unable to store instance '" + Persistable.class.getName() + "' from RDBMS: " + pbe.getMessage(), pbe);
tmpColl = broker.getCollectionByQuery(query); } catch (PersistenceBrokerException e) { throw new PersistenceException("strictObjectQuery caught a low-level PB exception: " + e.getMessage(), e);
logger.error("Unable to delete collection to RDBMS: " + pbe.getMessage(), pbe); throw new PersistenceException("Unable to delete instance '" + Persistable.class.getName() + "' from RDBMS: " + pbe.getMessage(), pbe);
/** * 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"); } }
rollbackTransaction(); } finally { logger.error("Unable to store instance '" + Persistable.class.getName() + "' from RDBMS: " + pbe.getMessage(), pbe); throw new PersistenceException("Unable to store instance '" + Persistable.class.getName() + "' from RDBMS: " + pbe.getMessage(), pbe);
/** * Performs a query and returns the count of objects the criteria specified * * @param query A fully constructed Query object * @throws PersistenceException If the query object is null or the broker is not initialized */ protected int countQuery(final Query query) throws PersistenceException { if (query != null) { if (broker != null) { try { return broker.getCount(query); } catch (PersistenceBrokerException e) { throw new PersistenceException("countQuery caught a low-level PB exception: " + e.getMessage(), e); } } else { throw new PersistenceException("Query called on uninitialized PersistenceBroker"); } } else { throw new PersistenceException("No query specified!"); } }
/** * Performs a report query and returns an iterator on the report * * @param query A fully constructed ReportQuery object * @return An iterator on the report query * @throws PersistenceException If the query object is null or the broker is not initialized */ protected Iterator<Object[]> reportQuery(Query query) throws PersistenceException { if (query != null) { if (broker != null) { try { return broker.getReportQueryIteratorByQuery(query); } catch (PersistenceBrokerException e) { throw new PersistenceException("reportQuery caught a low-level PB exception: " + e.getMessage(), e); } } else { throw new PersistenceException("Query called on uninitialized PersistenceBroker"); } } else { throw new PersistenceException("No query specified!"); } }
/** * Performs a query and returns an object matching the criteria specified * * @param query A fully constructed Query object * @return Object A Collection of Persistable objects as defined by the query * @throws PersistenceException If the query object is null or the broker is not initialized */ protected Object objectQuery(final Query query) throws PersistenceException { if (query != null) { if (broker != null) { try { return broker.getObjectByQuery(query); } catch (PersistenceBrokerException pbe) { throw new PersistenceException("objectQuery caught a low-level PB exception: " + pbe.getMessage(), pbe); } } else { throw new PersistenceException("Query called on uninitialized PersistenceBroker"); } } else { throw new PersistenceException("No query specified!"); } }
/** * Performs a query and returns a collection of objects matching the criteria specified * * @param query A fully constructed Query object * @return Collection A Collection of Persistable objects as defined by the query * @throws PersistenceException If the query object is null or the broker is not initialized */ protected Collection collectionQuery(final Query query) throws PersistenceException { if (query != null) { if (broker != null) { try { return broker.getCollectionByQuery(query); } catch (PersistenceBrokerException e) { throw new PersistenceException("collectionQuery caught a low-level PB exception: " + e.getMessage(), e); } } else { throw new PersistenceException("Query called on uninitialized PersistenceBroker"); } } else { throw new PersistenceException("No query specified!"); } }
logger.error("Failed to shallow update the Bean.", pbe); rollbackTransaction(); throw new PersistenceException("Failed to shallow update bean: " + pbe.getMessage(), pbe);
logger.error("PersistenceBrokerException during the execution of materializeObject: " + e.getMessage(), e);