Hi all,

I created the query as explained in the tutorial. When I call the resource
created from that query, if I capture the packets from the TCPMon, I can
see the result correctly. But when I try to get that response from my
jaggery code I don't get any response. This the code I use to call the
resource. Can someone tell me what am I doing wrong?

var optionalHeadersPost = {
        "Accept":"application/json",
            "Content-Type" : "application/json",
                "Authorization": "Basic "+base64_encode("admin:admin") };

var urladdfeature = DB_URL+"WSO2_QAP_FEATURE_DataService/add/feature";
var paramfeature = '{"_postadd_feature":{"WSO2_QAP_DESCRIPTION" :
"'+description+'","WSO2_QAP_REDMINE_URL" : "'+redmine+'","WSO2_QAP_SUBJECT"
: "'+subject+'"}}';
var insertresponse = post(urladdfeature, paramfeature, optionalHeadersPost,
"json", function (data, xhr) {
log("Response received");
} );


On Mon, Feb 10, 2014 at 5:08 PM, Amila Maha Arachchi <[email protected]>wrote:

> You don't need a separate query to get the last inserted id. Have a look
> at this
> http://docs.wso2.org/display/DSS311/Returning+Generated+Keys
>
>
> On Mon, Feb 10, 2014 at 4:51 PM, Maduranga Siriwardena <[email protected]
> > wrote:
>
>> Hi all,
>>
>> I'm using a data service and I want to get the last inserted id of a auto
>> incremented column from the database. After executing the insert query, I
>> call a get resource that execute the following query in the data service
>> server.
>>
>> <query id="get_last_inserted_id" useConfig="default">
>>       <sql>SELECT LAST_INSERT_ID() AS LAST_INSERTED_ID</sql>
>>       <result element="WSO2_QAP_FEATURECollection"
>> rowName="WSO2_QAP_FEATURE">
>>          <element column="LAST_INSERTED_ID" name="LAST_INSERTED_ID"
>> xsdType="xs:integer"/>
>>       </result>
>>    </query>
>>
>> Sometimes I get the correct id and sometimes I get "0" as the last
>> inserted id. Can someone help me to resolve this problem or any other
>> workaround to get the last inserted id.
>>
>> Regards
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Amila Maharachchi*
> Senior Technical Lead
> WSO2, Inc.; http://wso2.com
>
> Blog: http://maharachchi.blogspot.com
> Mobile: +94719371446
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to