@RequiresSession
  public Long findNextConfigVersion(long clusterId, String configType) {
    TypedQuery<Number> query = entityManagerProvider.get().createNamedQuery(
        "ClusterConfigEntity.findNextConfigVersion", Number.class);

    query.setParameter("clusterId", clusterId);
    query.setParameter("configType", configType);

    return daoUtils.selectSingle(query).longValue();
  }
Gets the next version that will be created for a given
{@link ClusterConfigEntity}.

@param clusterId
         the cluster that the service is a part of.
@param configType
         the name of the configuration type (not {@code null}).
@return the highest existing value of the version column + 1
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java