@Transactional
  public void removeByClusterAndHostName(final long clusterId, String hostName) {
    populateCache();

    HostEntity hostEntity = hostDAO.findByName(hostName);
    if (hostEntity != null) {
      if (hostConfigMappingByHost.containsKey(hostEntity.getHostId())) {
        // Delete from db
        TypedQuery<HostConfigMappingEntity> query = entityManagerProvider.get().createQuery(
            "SELECT entity FROM HostConfigMappingEntity entity " +
                "WHERE entity.clusterId = ?1 AND entity.hostId=?2",
            HostConfigMappingEntity.class);

        List<HostConfigMappingEntity> list = daoUtils.selectList(query, clusterId, hostEntity.getHostId());

        for (HostConfigMappingEntity entity : list) {
          entityManagerProvider.get().remove(entity);
        }

        // Remove from cache items with given clusterId
        Set<HostConfigMapping> set = hostConfigMappingByHost.get(hostEntity.getHostId());
        CollectionUtils.filter(set, new Predicate() {
          @Override
          public boolean evaluate(Object arg0) {
            return !((HostConfigMapping) arg0).getClusterId().equals(clusterId);
          }
        });
      }
    }
  }
Used for host configuration mapping operations.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostConfigMappingDAO.java