@Transactional
  public ClusterConfigEntity merge(ClusterConfigEntity clusterConfigEntity, boolean flush) {
    EntityManager entityManager = entityManagerProvider.get();
    ClusterConfigEntity clusterConfigEntityRes = entityManager.merge(clusterConfigEntity);
    if(flush) {
      entityManager.flush();
    }
    return clusterConfigEntityRes;
  }
Merge the specified entity into the current persistence context.

@param clusterConfigEntity
         the entity to merge (not {@code null}).
@param flush
         if {@code true} then {@link EntityManager#flush()} will be invoked
         immediately after the merge.
@return the managed entity which was merged (never {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java