Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD8D27BBE for ; Mon, 5 Dec 2011 16:40:57 +0000 (UTC) Received: (qmail 96467 invoked by uid 500); 5 Dec 2011 16:40:55 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 96436 invoked by uid 500); 5 Dec 2011 16:40:55 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 96428 invoked by uid 99); 5 Dec 2011 16:40:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2011 16:40:55 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sdddilrukshi@gmail.com designates 209.85.214.44 as permitted sender) Received: from [209.85.214.44] (HELO mail-bw0-f44.google.com) (209.85.214.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2011 16:40:47 +0000 Received: by bkcjc3 with SMTP id jc3so1319398bkc.31 for ; Mon, 05 Dec 2011 08:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=9ZIFOIVDCyZLzbrlfwcbIOmmIoP0O8Fehpcdun7S3eM=; b=lxDmM0wAFiw9XTJpSCG6U6dfFjPjvTb2lPAE3+bFx1ipVfbabcspo8NzH1X1IOIjyR zGvogOqcbKHsdt0hs7YDve4LJ4brMlwLyM3G3aL4IG7Ggsav202CCtz8aMxmG6IVnKMr ueiAqd6LuP4PwqbxYJ88EfDzsdgFb2L4ATzaM= MIME-Version: 1.0 Received: by 10.216.180.66 with SMTP id i44mr2028904wem.95.1323103227199; Mon, 05 Dec 2011 08:40:27 -0800 (PST) Received: by 10.216.5.208 with HTTP; Mon, 5 Dec 2011 08:40:27 -0800 (PST) Date: Mon, 5 Dec 2011 22:10:27 +0530 Message-ID: Subject: Setting Key Validation Class From: Dinusha Dilrukshi To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0016364267cddbc02504b35af9f1 X-Virus-Checked: Checked by ClamAV on apache.org --0016364267cddbc02504b35af9f1 Content-Type: text/plain; charset=ISO-8859-1 Hi, I am using apache-cassandra-1.0.0 and I tried to insert/retrieve data in a column family using cassandra-jdbc program. Here is how I created 'USER' column family using cassandra-cli. create column family USER with comparator=UTF8Type and column_metadata=[{column_name: user_id, validation_class: UTF8Type, index_type: KEYS}, {column_name: username, validation_class: UTF8Type, index_type: KEYS}, {column_name: password, validation_class: UTF8Type}]; But, when i try to insert data to USER column family it gives the error "java.sql.SQLException: Mismatched types: java.lang.String cannot be cast to java.nio.ByteBuffer". Since I have set user_id as a KEY and it's validation_class as UTF8Type, I was expected Key Validation Class as UTF8Type. But when I look at the meta-data of USER column family it shows as "Key Validation Class: org.apache.cassandra.db.marshal.BytesType" which has cause for the above error. When I created USER column family as follows, it solves the above issue. create column family USER with comparator=UTF8Type and key_validation_class=UTF8Type and column_metadata=[{column_name: user_id, validation_class: UTF8Type, index_type: KEYS}, {column_name: username, validation_class: UTF8Type, index_type: KEYS}, {column_name: password, validation_class: UTF8Type}]; Do we always need to define *key_validation_class* as in the above query ? Isn't it not enough to add validation classes for each column ? Regards, ~Dinusha~ --0016364267cddbc02504b35af9f1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I am using=A0apache-cassandra-1.0.0 and I tried to i= nsert/retrieve=A0data in a column family using cassandra-jdbc program.
Here is how I created 'USER' column family using cassandra-cl= i.

create column family USER with comparator=3DUTF8Ty= pe
and column_metadata=3D[{column_name: user_id, validation_class= : UTF8Type, index_type: KEYS},
{column_name: username, validation= _class: UTF8Type, index_type: KEYS},
{column_name: password, validation_class: UTF8Type}];
=
But, when i try to insert data to USER column family it give= s the error "java.sql.SQLException: Mismatched types: java.lang.String= cannot be cast to java.nio.ByteBuffer".

Since I have set user_id as a KEY and it's=A0valida= tion_class as UTF8Type, I was expected=A0Key Validation Class as=A0UTF8Type= .=A0
But when I look at the meta-data of USER column family it sh= ows as "Key Validation Class: org.apache.cassandra.db.marshal.BytesTyp= e" which has cause for the above error.

When I created USER column family as follows, it solves= the above issue.

create column family USER w= ith comparator=3DUTF8Type and key_validation_class= =3DUTF8Type
and column_metadata=3D[{column_name: user_id, validation_class: UTF8Ty= pe, index_type: KEYS},
{column_name: username, validation_class: = UTF8Type, index_type: KEYS},
{column_name: password, validation_c= lass: UTF8Type}];

Do we always need to define=A0key_validation_class=A0as in the above query ? Isn't = it not enough to add validation classes for each column ?

Regards,
~Dinusha~

--0016364267cddbc02504b35af9f1--