Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


Ryan Quey avatar image
Ryan Quey asked ·

Why are clustering keys missing when instantiating Dao from InventoryMapper?

I am using the Cassandra Java Driver, v.4.6.1.

While creating an instance of my DAO instance, I hit the following error:

com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: Some clustering keys are missing: primary_genre, feed_url

Those are indeed my clustering keys, however I'm not sure what they are missing from.

The error appears similar to this one, except the difference is that I didn't realize I was even hitting the db. The stack trace shows that this error comes up on the bottom line, where I'm creating a DAO instance:

InventoryMapper inventoryMapper = InventoryMapper.builder(db.session).build(); 
PodcastDao dao = inventoryMapper.podcastDao("podcast_analysis_tool", "podcasts_by_language");

Here is some of my other code, in case it's helpful

InventoryMapper class :

public interface InventoryMapper {
  PodcastDao podcastDao(@DaoKeyspace String keyspace, @DaoTable String table);

Class definition:

public class Podcast {
   private String language;
   private String primaryGenre;
   private String feedUrl;

CQL to define the table:

CREATE TABLE IF NOT EXISTS podcast_analysis_tool.podcasts_by_language (owner TEXT, name TEXT, image_url30 TEXT,image_url60 TEXT,image_url100 TEXT,image_url600 TEXT, api TEXT, api_id TEXT, api_url TEXT, country TEXT,feed_url TEXT, genres LIST<TEXT>, api_genre_ids LIST<TEXT>,primary_genre TEXT,release_date TIMESTAMP,explicit BOOLEAN,episode_count INT,rss_feed TEXT,found_by_queries List<frozen<Map<Text, Text>>>, description TEXT,summary TEXT,description_subtitle TEXT,webmaster TEXT,owner_email TEXT,author TEXT,language
TEXT,website_url TEXT,updated_at TIMESTAMP, PRIMARY KEY ((language), primary_genre, feed_url)) WITH CLUSTERING ORDER BY(primary_genre ASC, feed_url ASC);
java driver
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Ryan Quey avatar image
Ryan Quey answered ·

Found out the answer on my own:

In my PodcastDao class, the `@Update` method wasn't sending in all the clustering columns. In other words, even when just instantiating a DAO instance for a class, if the definitions aren't correct it will throw an error as if already performing the CQL query (in this case, throwing as if it had done an UPDATE).

10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.