Cassandra inserts and updates should always be modeled as upserts when possible. Using the query builder in the Java native driver there isn’t a direct upsert called out, but we can do updates instead of inserts for all cases. The update acts as an upsert and it reduces the number of queries you will need to build.
Above you can see how we model our “upsert”. If a value isn’t found for the given where clause it will insert it.
You must use all parts of a Primary Key for an updates where cluase given a CQL Table with a compound key: