更新失败时,Cassandra Datastax驱动程序未给出错误

时间:2018-09-03 07:43:40

标签: cassandra-3.0 datastax-java-driver

我有下表。

CREATE TABLE codingjedi.users (
    bucket int,
    email text,
    authprovider text,
    firstname text,
    lastname text,
    confirmed boolean,
    hasher text,
    id uuid,
    password text,
    salt text,
    PRIMARY KEY ((bucket, email), authprovider, firstname, lastname)
) WITH CLUSTERING ORDER BY (authprovider ASC, firstname ASC, lastname ASC)

我试图更新表的一行,但是我没有完全限定该行。我只指定了partition key,部分指定了clustering columns

def updateValues(tableName:String, model:User, id:UserKeys):Update.Where = {
    QueryBuilder.update(tableName).`with`(QueryBuilder.set("confirmed",model.profile.internalProfileDetails.get.confirmed))/*(QueryBuilder.set("authprovider",model.profile.internalProfileDetails.get.loginInfo.providerID)) //TODOM - remove hardcoding for bucket and also add bucket in User model*/
      .and(QueryBuilder.set("id",model.id))
      .and(QueryBuilder.set("password",model.profile.internalProfileDetails.get.passwordInfo.get.password))
      .and(QueryBuilder.set("hasher",model.profile.internalProfileDetails.get.passwordInfo.get.hasher))
      .and(QueryBuilder.set("salt",""/*model.profile.internalProfileDetails.get.passwordInfo.get.salt.get*/)) //salt is empty for BCryptSha256PasswordHasher. The 'hash' method of BCryptSha256PasswordHasher does not return the salt separately because it is embedded in the hashed password.
      .where(QueryBuilder.eq("bucket", id.bucket)) //TODOM - pick column names from config/env file
      .and(QueryBuilder.eq("email", id.email))
      .and(QueryBuilder.eq("authprovider", model.profile.internalProfileDetails.get.loginInfo.providerID))//TODOM - this should come from id
      .and(QueryBuilder.eq("firstname",model.profile.externalProfileDetails.firstName))
      /*.and(QueryBuilder.eq("lastname",model.profile.externalProfileDetails.lastName))*//*REMOVED a clustering column value*/

  }

以上查询失败,行未更新,但控制台中也未显示任何错误消息。

但是,如果我在cqlsh中尝试同样的操作,则会看到错误InvalidRequest: Error from server: code=2200 [Invalid query] message="Some clustering keys are missing: lastname"

为什么Datastax未报告错误,我如何使其显示错误?

0 个答案:

没有答案