public StackEntity findByMpack(Long mpackId) {
    TypedQuery<StackEntity> query = entityManagerProvider.get().createNamedQuery(
            "StackEntity.findByMpack", StackEntity.class);
    query.setParameter("mpackId", mpackId);

    return daoUtils.selectOne(query);
  }
Gets the stack that matches the specified mpackid.

@return the stack matching the specified mpackid or {@code null}
        if none.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StackDAO.java