I have a Cassandra table Department
with columns name_list extends ListColumn[String]
and id extends StringColumn with PartitionKey
.
I want to fetch id where the requested name is present in name_list.
I tried using in operator select(_.id).where(name in name_list)
but it is not working.
Another query I tried select(_.id).where(_.name_list contains name)
but it is also not working for me.
def getByName(name: String) = {
select(_.id, _.name_list).where(_.name_list contains name)
}
Is there any way to solve this!!
You can use the SetColumn as the type for you column then you will be able to use the
contains
method. Use thisname_list extends SetColumn[String]
then this will work fine
Thanks