From user-return-33876-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Thu May 2 21:21:49 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 EF3A510568 for ; Thu, 2 May 2013 21:21:49 +0000 (UTC) Received: (qmail 43313 invoked by uid 500); 2 May 2013 21:21:47 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 43285 invoked by uid 500); 2 May 2013 21:21:47 -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 43272 invoked by uid 99); 2 May 2013 21:21:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 21:21:47 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a91.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 21:21:42 +0000 Received: from homiemail-a91.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a91.g.dreamhost.com (Postfix) with ESMTP id C2996AE05B for ; Thu, 2 May 2013 14:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h=from :content-type:message-id:mime-version:subject:date:references:to :in-reply-to; s=thelastpickle.com; bh=CNM+briy43M742zZHLT6TB/0xt A=; b=cUYwQHHqyiAOhZ4fayByspiIb7oUy9y/hzOUeJuBwDAoRFq5JDPHgOSQMJ WsVTeUJiClKCcaKD0SrlQ8EWmtRKgpeFMr1WXEyNXs0DUAHdi0U4UPxe2GJTtiGg k1rMHSnxkJGhfEJOHHTWjot6CoCbKmNsgDct4o42e2nbAcxqg= Received: from [172.16.1.8] (unknown [203.86.207.101]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a91.g.dreamhost.com (Postfix) with ESMTPSA id 3C241AE059 for ; Thu, 2 May 2013 14:21:05 -0700 (PDT) From: aaron morton Content-Type: multipart/alternative; boundary="Apple-Mail=_ACDD524F-D6F6-401C-8A74-A823C30EB9E8" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: Exception inserting UUID's into Cassandra using JDBC driver Date: Fri, 3 May 2013 09:21:18 +1200 References: To: user@cassandra.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1503) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_ACDD524F-D6F6-401C-8A74-A823C30EB9E8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii There is an open ticket for this = https://code.google.com/a/apache-extras.org/p/cassandra-jdbc/issues/detail= ?id=3D72 Cheers ----------------- Aaron Morton Freelance Cassandra Consultant New Zealand @aaronmorton http://www.thelastpickle.com On 3/05/2013, at 1:57 AM, Robert Wille wrote: > Just downloaded the latest Cassandra and JDBC driver. When I try to = insert UUID's into a column family, I get an exception. >=20 > Here's how I created the column family: >=20 > CREATE TABLE browse.tree (tree_id UUID PRIMARY KEY, activation_time = TIMESTAMP, tree_lock_id INT, sql_publication_id INT); >=20 > Here's some code that produces the problem: >=20 > UUID uuid =3D java.util.UUID.randomUUID(); > PreparedStatement statement =3D c.prepareStatement("insert into tree = (tree_id) values (?)"); > statement.setObject(1, uuid); > statement.execute(); >=20 > And here's the exception I get: >=20 > 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.j= ava:124) > at = org.apache.cassandra.cql.jdbc.HandleObjects.makeBytes(HandleObjects.java:3= 91) > at = org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.setObject(Cassand= raPreparedStatement.java:351) > at = org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.setObject(Cassand= raPreparedStatement.java:338) > at CassandraTest.main(CassandraTest.java:26) >=20 > 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. >=20 > Any help would be appreciated. Thanks. >=20 > Robert --Apple-Mail=_ACDD524F-D6F6-401C-8A74-A823C30EB9E8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii There = is an open ticket for this https://code.google.com/a/apache-extras.org/p/cassandra-= jdbc/issues/detail?id=3D72

Cheers

http://www.thelastpickle.com

On 3/05/2013, at 1:57 AM, Robert Wille <rwille@footnote.com> = wrote:

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 =3D = java.util.UUID.randomUUID();
PreparedStatement statement =3D = 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.j= ava:124)
        at = org.apache.cassandra.cql.jdbc.HandleObjects.makeBytes(HandleObjects.java:3= 91)
        at = org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.setObject(Cassand= raPreparedStatement.java:351)
        at = org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.setObject(Cassand= raPreparedStatement.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

= --Apple-Mail=_ACDD524F-D6F6-401C-8A74-A823C30EB9E8--