@Transactional
  public WidgetLayoutEntity mergeWithFlush(WidgetLayoutEntity widgetLayoutEntity) {
    EntityManager entityManager = entityManagerProvider.get();
    widgetLayoutEntity = entityManager.merge(widgetLayoutEntity);
    entityManager.flush();
    entityManager.refresh(widgetLayoutEntity);
    return widgetLayoutEntity;
  }
DAO utilities for dealing mostly with {@link TypedQuery} results.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAO.java