Return-Path: X-Original-To: apmail-incubator-ambari-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-ambari-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53F52E62B for ; Fri, 11 Jan 2013 01:21:11 +0000 (UTC) Received: (qmail 43131 invoked by uid 500); 11 Jan 2013 01:21:11 -0000 Delivered-To: apmail-incubator-ambari-dev-archive@incubator.apache.org Received: (qmail 43111 invoked by uid 500); 11 Jan 2013 01:21:11 -0000 Mailing-List: contact ambari-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@incubator.apache.org Delivered-To: mailing list ambari-dev@incubator.apache.org Received: (qmail 43100 invoked by uid 99); 11 Jan 2013 01:21:11 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2013 01:21:11 +0000 Date: Fri, 11 Jan 2013 01:21:11 +0000 (UTC) From: "Yusaku Sako (JIRA)" To: ambari-dev@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AMBARI-1129) Updating service configuration for a service via the api fails with a sql error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMBARI-1129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Yusaku Sako updated AMBARI-1129: -------------------------------- Issue Type: Bug (was: Sub-task) Parent: (was: AMBARI-666) > Updating service configuration for a service via the api fails with a sql error > ------------------------------------------------------------------------------- > > Key: AMBARI-1129 > URL: https://issues.apache.org/jira/browse/AMBARI-1129 > Project: Ambari > Issue Type: Bug > Components: controller > Reporter: John Speidel > Assignee: John Speidel > Fix For: 1.2.0 > > Attachments: AMBARI-1129.patch > > > In ServiceConfigMappingDAO, the where clause of the sql query is built incorrectly. In the below code snippet, the argument "?5" is used in the where clause and there are only three arguments that get set. The 5 should be changed to a 3. > TypedQuery query = > entityManagerProvider.get().createQuery( > "SELECT config FROM ServiceConfigMappingEntity config" > + " WHERE " > + " config.clusterId = ?1" > + " AND config.serviceName = ?2" > + " AND config.configType IN ?5", > ServiceConfigMappingEntity.class); > return daoUtils.selectList(query, clusterId, serviceName, configTypes); > As a result, the query fails because there is no arg 5. This results in the below stack trace: > java.lang.IllegalArgumentException: You have attempted to set a parameter at position 3 which does not exist in this query string SELECT config FROM ServiceConfigMappingEntity config WHERE config.clusterId = ?1 AND config.serviceName = ?2 AND config.configType IN ?5. > at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:820) > at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:801) > at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:451) > at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:1) > at org.apache.ambari.server.orm.dao.DaoUtils.setParameters(DaoUtils.java:57) > at org.apache.ambari.server.orm.dao.DaoUtils.selectList(DaoUtils.java:33) > at org.apache.ambari.server.orm.dao.ServiceConfigMappingDAO.findByServiceAndType(ServiceConfigMappingDAO.java:63) > at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66) > at org.apache.ambari.server.orm.dao.ClearEntityManagerInterceptor.invoke(ClearEntityManagerInterceptor.java:41) > at org.apache.ambari.server.state.ServiceImpl.updateDesiredConfigs(ServiceImpl.java:296) > at org.apache.ambari.server.controller.AmbariManagementControllerImpl.updateServices(AmbariManagementControllerImpl.java:2107) > ... -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira