Skip to content

Wrong CQL query generated when using SET datatype in Cassandra #1031

@sohelmk

Description

@sohelmk

Hi,
I am using Kundera with Cassadra db, but unable to insert an entity that has one of datatype as Set[String]. When I checked the logs the CQL generated is wrong. Set are supposed to be given as {""}.
Please let me know if any workaround. Note the language is scala, most examples online show java.util.set. There is built-in datatype in scala called set that is interoperable with java.

[error] c.i.c.c.CassandraClientBase - Error while executing query INSERT INTO "groups"("created_by","group_image","access_type","labels","updated_timestamp","created_timestamp","updated_by","description","group_account","group_name","group_id") VALUES(35bb8547-e0d0-42a9-b761-c2b91cea56fd,0x62646231346662653037366636623934343434633636306533366134303031353166323666633666,'public',Set(test),'1541546600000','1541546600000',bbcc1f44-c6cf-4de2-9a77-1dfe0f754bf2,'dd','STANDARD','dd',35bb8547-e0d0-42a9-b761-c2b91cea56fd)
[error] c.c.d.RespondentGroupsDAOImpl - addGroup Error :
com.impetus.kundera.KunderaException: com.impetus.kundera.KunderaException: InvalidRequestException(why:line 1:316 no viable alternative at input 'Set' (...) VALUES(35bb8547-e0d0-42a9-b761-c2b91cea56fd,0x62646231346662653037366636623934343434633636306533366134303031353166323666633666,'public',[Set]...))
at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:180)
at com.consultengine.daos.RespondentGroupsDAOImpl$.addGroup(RespondentGroupsDAO.scala:261)
at com.consultengine.services.UserService.addGroup(UserService.scala:151)
at com.consultengine.controllers.v1.GroupsController.$anonfun$addGroup$1(GroupsController.scala:37)
at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:482)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions