Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:

Home Page:http://groups.google.com/group/kundera-discuss/subscribe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

insert json object as string in cassandra table

prasadgsk opened this issue · comments

Hi,

I want to insert this entire json structure as String in cassandra table. How can i do it?

"testResult": "{"apiVersion":"v1","items":[{"name":"srehelloworld-0-0-1-d2a-5bb4df7-jqtqd","namespace":"com-xyz-resiliency-dev","clusterName":null,"uid":"8f1db6b67-11e8-8525-fa163e02ebbc","labels":{"app":"HelloWorld","pod-template-hash":"1665370893","routeoffer":"X1A","version":"0.0.1"},"annotations":{"GRM_NS":"com-xyz-resiliency-dev","kubernetes.io/created-by":"{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"ReplicaSet\",\"namespace\":\"com-xyz-resiliency-dev\",\"name\":\"helloworld-0-0-1-d2a-5b7c4df7\",\"uid\":\"c36f6fee-9b57-11e8-b334-fa163e12181e\",\"apiVersion\":\"extensions\",\"resourceVersion\":\"205648472\"}}\n","kubernetes.io/psp":"restricted-with-root","prometheus.io/port":"8000","prometheus.io/scrape.ne":"true","seccomp.security.alpha.kubernetes.io/pod":"docker/default"},"spec":{"containers":[{"readinessProbe":null}]}}],"kind":"PodList","metadata":{"resourceVersion":"2204579","selfLink":"/api/v1/namespaces/com-xyz-resiliency-dev/pods","continue":null}}"

I declared it as String, but getting this exception.

Caused by: InvalidRequestException(why:Invalid STRING constant ({"apiVersion":"v1"......) for "testResult" of type blob)
at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result$execute_cql3_query_resultStandardScheme.read(Cassandra.java:50297)
at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result$execute_cql3_query_resultStandardScheme.read(Cassandra.java:50274)
at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result.read(Cassandra.java:50189)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_cql3_query(Cassandra.java:1734)
at org.apache.cassandra.thrift.Cassandra$Client.execute_cql3_query(Cassandra.java:1719)
at com.impetus.client.cassandra.CassandraClientBase.execute(CassandraClientBase.java:2341)
... 103 mor
Thanks,
Prasad

Hi @prasadgsk,

I tried to replicate your issue at my end with Kundera 3.13 and Casandra 3.11.3 and its working fine.

I downloaded the sample project from https://github.com/Impetus/Kundera#sample-projects

Maybe you can try with this sample project and let me know if you are still facing this issue?