@Transactional
  RepositoryVersionEntity createRepositoryVersion(String version, final StackId stackId, final StackInfo stackInfo) throws AmbariException {
    // During an Ambari Upgrade from 1.7.0 -> 2.0.0, the Repo Version will not exist, so bootstrap it.
    LOG.info("Creating new repository version " + stackId.getStackName() + "-" + version);

    StackEntity stackEntity = stackDAO.find(stackId.getStackName(),
      stackId.getStackVersion());

    // Ensure that the version provided is part of the Stack.
    // E.g., version 2.3.0.0 is part of HDP 2.3, so is 2.3.0.0-1234
    if (null == version) {
      throw new AmbariException(MessageFormat.format("Cannot create Repository Version for Stack {0}-{1} if the version is empty",
          stackId.getStackName(), stackId.getStackVersion()));
    }

    return repositoryVersionDAO.create(
        stackEntity,
        version,
        stackId.getStackName() + "-" + version,
        repositoryVersionHelper.createRepoOsEntities(stackInfo.getRepositories()));
  }
@param lastOpLastUpdateTime the lastOpLastUpdateTime to set
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java