@Transactional
  public void merge(Collection<ClusterConfigEntity> clusterConfigEntities, boolean flush) {
    EntityManager entityManager = entityManagerProvider.get();
    for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
      entityManager.merge(clusterConfigEntity);
    }
    if(flush) {
      entityManager.flush();
    }
  }
Merge the specified list of cluster config entities into the current persistence context.
@param clusterConfigEntities the entity to merge (not {@code null}).
@param flush if {@code true} then {@link EntityManager#flush()} will be invoked
             immediately after the merge.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java