@Override
  @Transactional
  public void create(HostVersionEntity entity) throws IllegalArgumentException{
    // check if repository version is not missing, to avoid NPE
    if (entity.getRepositoryVersion() == null) {
      throw new IllegalArgumentException("RepositoryVersion argument is not set for the entity");
    }

    super.create(entity);
    entity.getRepositoryVersion().updateHostVersionEntityRelation(entity);
  }
Construct a Host Version. Additionally this will update parent connection relations without
forcing refresh of parent entity
@param entity entity to create
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java