diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExpressionQuery.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExpressionQuery.java index 800cb21d37..9497a2f77e 100644 --- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExpressionQuery.java +++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/ExpressionQuery.java @@ -44,6 +44,8 @@ public abstract class ExpressionQuery extends Query { private String query; + private String originalQuery; + private List namedParamNames; private int paramCount; @@ -57,12 +59,17 @@ public ExpressionQuery(DataService dataService, String queryId, List super(dataService, queryId, queryParams, result, configId, inputEventTrigger, outputEventTrigger, advancedProperties, inputNamespace); this.query = query; + this.originalQuery = query; } public String getQuery() { return query; } + public String getOriginalQuery() { + return originalQuery; + } + public int getParamCount() { return paramCount; } diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/QuerySerializer.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/QuerySerializer.java index 8e6bf682e8..12c832e6fb 100644 --- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/QuerySerializer.java +++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/QuerySerializer.java @@ -121,7 +121,7 @@ private static void serializeAdvancedProps(Query query, OMElement queryEl, OMFac private static void serializeSQLQueryProps(SQLQuery sqlQuery, OMElement queryEl, OMFactory fac) { OMElement sqlEl = fac.createOMElement(new QName(DBSFields.SQL)); - sqlEl.setText(sqlQuery.getQuery()); + sqlEl.setText(sqlQuery.getOriginalQuery()); queryEl.addChild(sqlEl); if (sqlQuery.isReturnGeneratedKeys()) { queryEl.addAttribute(DBSFields.RETURN_GENERATED_KEYS, Boolean.TRUE.toString(), null); @@ -310,7 +310,7 @@ private static void serializeQueryParams(List queryParams, } defaultValue = queryParam.getDefaultValue(); if (defaultValue != null && defaultValue.getScalarValue() != null) { - queryParamEl.addAttribute(DBSFields.ORDINAL, defaultValue.getScalarValue(), null); + queryParamEl.addAttribute(DBSFields.DEFAULT_VALUE, defaultValue.getScalarValue(), null); } /* add validators */ serializeValidators(queryParam.getValidators(), queryParamEl, fac);