@Override
  @Transactional
  public void removeHostRequests(long logicalRequestId, Collection<HostRequest> hostRequests) {
    TopologyLogicalRequestEntity logicalRequest = topologyLogicalRequestDAO.findById(logicalRequestId);
    for (HostRequest hostRequest : hostRequests) {
      TopologyHostRequestEntity hostRequestEntity = hostRequestDAO.findById(hostRequest.getId());
      if (logicalRequest != null)  {
        logicalRequest.getTopologyHostRequestEntities().remove(hostRequestEntity);
      }
      hostRequestDAO.remove(hostRequestEntity);
    }
    if (logicalRequest != null && logicalRequest.getTopologyHostRequestEntities().isEmpty()) {
      Long topologyRequestId = logicalRequest.getTopologyRequestId();
      topologyLogicalRequestDAO.remove(logicalRequest);
      topologyRequestDAO.removeByPK(topologyRequestId);
    }
  }
Implementation which uses Ambari Database DAO and Entity objects for persistence
of topology related information.
ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java