incubator-ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Speidel (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMBARI-1129) Updating service configuration for a service via the api fails with a sql error
Date Thu, 03 Jan 2013 19:10:13 GMT
John Speidel created AMBARI-1129:
------------------------------------

             Summary: 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: Sub-task
          Components: controller
            Reporter: John Speidel
            Assignee: John Speidel


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<ServiceConfigMappingEntity> 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

Mime
View raw message