From user-return-33869-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Thu May 2 13:57:47 2013 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 150BCF299 for ; Thu, 2 May 2013 13:57:47 +0000 (UTC) Received: (qmail 99805 invoked by uid 500); 2 May 2013 13:57:44 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 99619 invoked by uid 500); 2 May 2013 13:57:44 -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 99591 invoked by uid 99); 2 May 2013 13:57:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 13:57:43 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,MIME_QP_LONG_LINE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rwille@fold3.com designates 38.101.149.73 as permitted sender) Received: from [38.101.149.73] (HELO mx02.iarchives.com) (38.101.149.73) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 13:57:37 +0000 Received: from mx02.iarchives.com (localhost [127.0.0.1]) by mx02.iarchives.com (Postfix) with ESMTP id BE0F6C12FB for ; Thu, 2 May 2013 07:57:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=footnote.com; h=date :subject:from:to:message-id:mime-version:content-type; s=m1; bh= 5vmxH5p4uDZl11/0uCEXy+kslnJJDGG1vyNtftgTl0k=; b=J5h2vltGvgMF2s5q 8KHvXZ9QAnNTcDDJFrN0fMeWrg9pMeVKXvGJO1lJbgLxlsQt3QVjdb0NaD9DIaSj qG4vbK7bAFzCPQD41lyaFLFP60wWEVpS63c4x+pdp1bz7llamJsT5dr70LuoXJNv aTKV/DY0bkryGnG6JoovcvcbYFg= Received: from PANDORA.iarchives.com (pandora.iarchives.com [192.168.100.88]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx02.iarchives.com (Postfix) with ESMTPS id 9EC3DC12FA for ; Thu, 2 May 2013 07:57:15 -0600 (MDT) Received: from [10.88.88.10] (192.168.97.117) by PANDORA.iarchives.com (192.168.100.88) with Microsoft SMTP Server (TLS) id 14.1.438.0; Thu, 2 May 2013 07:59:55 -0600 User-Agent: Microsoft-MacOutlook/14.14.0.111121 Date: Thu, 2 May 2013 07:57:05 -0600 Subject: Exception inserting UUID's into Cassandra using JDBC driver From: Robert Wille To: Message-ID: Thread-Topic: Exception inserting UUID's into Cassandra using JDBC driver MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="B_3450326234_138202707" X-Virus-Checked: Checked by ClamAV on apache.org --B_3450326234_138202707 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Just downloaded the latest Cassandra and JDBC driver. When I try to insert UUID's into a column family, I get an exception. Here's how I created the column family: CREATE TABLE browse.tree (tree_id UUID PRIMARY KEY, activation_time TIMESTAMP, tree_lock_id INT, sql_publication_id INT); Here's some code that produces the problem: UUID uuid = java.util.UUID.randomUUID(); PreparedStatement statement = c.prepareStatement("insert into tree (tree_id) values (?)"); statement.setObject(1, uuid); statement.execute(); And here's the exception I get: java.sql.SQLNonTransientException: encountered object of class: class java.util.UUID, but only 'String' is supported to map to the various VARCHAR types at org.apache.cassandra.cql.jdbc.HandleObjects.makeBadMapping(HandleObjects.jav a:124) at org.apache.cassandra.cql.jdbc.HandleObjects.makeBytes(HandleObjects.java:391 ) at org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.setObject(Cassandra PreparedStatement.java:351) at org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.setObject(Cassandra PreparedStatement.java:338) at CassandraTest.main(CassandraTest.java:26) I've tried using the string representation, but then it complains saying that it needs to be exactly 16 bytes. I've tried inserting as a byte array of length 16, but I get the same exception as above. Any help would be appreciated. Thanks. Robert --B_3450326234_138202707 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
Just downloaded the= latest Cassandra and JDBC driver. When I try to insert UUID's into a column= family, I get an exception.

Here's how I= created the column family:

CREATE TABLE browse.tree (tree_id UUI= D PRIMARY KEY, activation_time TIMESTAMP, tree_lock_id INT, sql_publication_= id INT);

Here's some code that produces the problem:

UUID uuid =3D java= .util.UUID.randomUUID();
PreparedStatement statement =3D c.prepareSt= atement("insert into tree (tree_id) values (?)");
statement.setObj= ect(1, uuid);
statement.execute();

And he= re's the exception I get:

java.sql.SQLNonTrans= ientException: encountered object of class: class java.util.UUID, but only '= String' is supported to map to the various VARCHAR types
  &n= bsp;     at org.apache.cassandra.cql.jdbc.HandleObjects.makeBadMap= ping(HandleObjects.java:124)
        at org.ap= ache.cassandra.cql.jdbc.HandleObjects.makeBytes(HandleObjects.java:391)
        at org.apache.cassandra.cql.jdbc.Cassandra= PreparedStatement.setObject(CassandraPreparedStatement.java:351)
&= nbsp;       at org.apache.cassandra.cql.jdbc.CassandraPrepare= dStatement.setObject(CassandraPreparedStatement.java:338)
  &= nbsp;     at CassandraTest.main(CassandraTest.java:26)
=

I've tried using the string representation, but then it = complains saying that it needs to be exactly 16 bytes. I've tried inserting = as a byte array of length 16, but I get the same exception as above.

Any help would be appreciated. Thanks.

Robert
--B_3450326234_138202707--