Hi Mihil,

The problem is in your sql query. In the where clause you can filter by a
column name. But in your query you are trying to filter it by the whatever
value passes for 'name' parameter. Thats why you are getting an unexpected
behavior.

Thanks


On Wed, Feb 19, 2014 at 2:58 PM, Mihil Ranathunga <mi...@wso2.com> wrote:

> Hi all,
>
> I'm trying to create rest resources in wso2dss. I get following error when
> i try to put resource parameters in the resource path
>
> https://gist.github.com/mihilranathunga/9088513
>
> *my query*
>
>    <query id="GetDeviceByID" useConfig="WSO2_HWDREPO_SERVICE">
>       <sql>select * from device where device_id=:device_id and :emp_id in
> (select employee_id from assignment where
> assignment.device_id=:device_id)</sql>
>       <result element="BaseElement" rowName="Element">
>          <element column="device_id" name="device_id" xsdType="integer"/>
>          <element column="make" name="make" xsdType="string"/>
>          <element column="model" name="model" xsdType="string"/>
>          <element column="rating" name="rating" xsdType="integer"/>
>
> .......................................................................................
>       </result>
>       <param name="device_id" sqlType="INTEGER"/>
>       <param name="emp_id" sqlType="STRING"/>
>    </query>
>
> *resource*
>
>  <resource method="GET" path="user/{emp_id}/devices/{device_id}">
>       <description>Get device details by providing id  </description>
>       <call-query href="GetDeviceByID">
>          <with-param name="device_id" query-param="device_id"/>
>          <with-param name="emp_id" query-param="emp_id"/>
>       </call-query>
>
> But it works when i put path="user/devices/{device_id}"
>
> serviceUrl/user/mi...@wso2.com/devices/210  is not working(browser)
> ServiceUrl/user/devices/210?emp_id=mi...@wso2.com is working in the
> browser when path is set to "user/devices/{device_id}"
>
> Any ideas?
>
> Thanks,
> Mihil
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Best Regards..

Chanika Geeganage
Software Engineer
WSO2, Inc.; http://wso2.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to