agave-monitors/monitors-core/src/main/java/org/iplantc/service/monitor/dao/MonitorCheckDao.java
/**
	 * Deletes all {@link MonitorCheck}s from the db for a given monitor.
	 *
	 * @param monitor the monitor whose checks will be deleted
	 * @throws MonitorException if unable to process the delete
	 */
Deletes all  MonitorChecks from the db for a given monitor.
@param monitor the monitor whose checks will be deleted
@throws MonitorException if unable to process the delete
Deletes all MonitorChecks from the db for a given monitor . @param monitor the monitor whose checks will be deleted @throws MonitorException if unable to process the delete
public void deleteAllForMonitor(Monitor monitor) throws MonitorException {
		if (monitor == null)
			throw new MonitorException("MonitorCheck cannot be null");
		try {
			HibernateUtil.beginTransaction();
			Session session = HibernateUtil.getSession();
			String hql = "DELETE from MonitorCheck mc " +
					"where mc.monitor.id = :monitorId";
			session.createQuery(hql)
					.setLong("monitorId", monitor.getId())
					.setCacheable(false)
					.setCacheMode(CacheMode.IGNORE)
					.executeUpdate();
			session.flush();
		}
		catch (HibernateException ex)
		{
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception ignored) {}
			throw new MonitorException("Failed to delete monitor check", ex);
		}
		finally {
			try { HibernateUtil.commitTransaction(); } catch (Exception ignored) {}
		}
	}
public void deleteAllForMonitor ( Monitor monitor ) throws MonitorException { if ( monitor == null ) throw new MonitorException ( "MonitorCheck cannot be null" ) ; try { HibernateUtil . beginTransaction ( ) ; Session session = HibernateUtil . getSession ( ) ; String hql = "DELETE from MonitorCheck mc " + "where mc.monitor.id = :monitorId" ; session . createQuery ( hql ) . setLong ( "monitorId" , monitor . getId ( ) ) . setCacheable ( false ) . setCacheMode ( CacheMode . IGNORE ) . executeUpdate ( ) ; session . flush ( ) ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw new MonitorException ( "Failed to delete monitor check" , ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Deletes all {@link MonitorCheck}s from the db for a given monitor.
Deletes all { @link MonitorCheck } s from the db for a given monitor .