0

I am running the insert example from WSO2 DSS to Cassandra Database.

Here is my DSS with Casandra Database insert Configuration.

<data name="Cdno">
   <config id="insert">
      <property name="url">jdbc:cassandra://localhost:9160/employee</property>
      <property name="driverClassName">org.apache.cassandra.cql.jdbc.CassandraDriver</property>
   </config>
   <query id="Insertinto" useConfig="insert">
      <sql>INSERT INTO employee.dept(eno,dno) values(?,?)</sql>
      <result element="Body" rowName="Datalist">
         <element column="eno" name="eno" xsdType="integer"/>
         <element column="dno" name="dno" xsdType="integer"/>
      </result>
      <param name="eno" ordinal="1" sqlType="INTEGER"/>
      <param name="dno" ordinal="2" sqlType="INTEGER"/>
   </query>
   <operation name="insertinto">
      <call-query href="Insertinto">
         <with-param name="eno" query-param="eno"/>
         <with-param name="dno" query-param="dno"/>
      </call-query>
   </operation>
</data>

While i am inserting data from DSS try this service to Cassandra Database , i am getting the following error. How can i achieve this .

DS Code: DATABASE_ERROR
Source Data Service:-
Name: Cdno
Location: /Cdno.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: insertinto
Current Params: {eno=5, dno=6}
Nested Exception:-
java.sql.SQLSyntaxErrorException: Expected key 'KEY' to be present in WHERE clause for 'dept'

    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
    at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
    at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
    at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
    at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
    at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
    ... 38 more
Community
  • 1
  • 1
user1983299
  • 393
  • 1
  • 5
  • 16
  • Can you show me the schema you are using for your datamodel? I have a feeling you are inserting a partition (row) without specifying a primary key for said partition. – Lyuben Todorov Jun 26 '13 at 09:06

2 Answers2

0

When you insert data in cassandra, you should pass the key information also.. Check the sample

Ratha
  • 9,434
  • 17
  • 85
  • 163
0

WSO2 is generating an invalid request. I don't think there's much you can do besides report a bug.

jbellis
  • 19,347
  • 2
  • 38
  • 47