@Transactional
  public HostComponentStateEntity merge(HostComponentStateEntity hostComponentStateEntity) {
    EntityManager entityManager = entityManagerProvider.get();
    hostComponentStateEntity = entityManager.merge(hostComponentStateEntity);
//    Flush call here causes huge performance loss on bulk update of host components
//    we should consider other solutions for issues with concurrent transactions
//    entityManager.flush();
    return hostComponentStateEntity;
  }
Merges the managed entity

@param hostComponentStateEntity
@return
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java