You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Andreas Finke <An...@solvians.com> on 2015/02/05 18:10:49 UTC

Problems with user defined types (cql) and Datastax Java Driver

Hi,

I encountered the problem that in Java the Session does not create a valid UserType for my corresponding CQL user defined type.

CQL_SCHEMA:

create keyspace if not exists quotes
WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

CREATE TYPE IF NOT EXISTS quotes.price (
                value double,
                size bigint,
                timestamp bigint,
                delay int
);

JAVA

UserType priceType = session.getCluster().getMetadata().getKeyspace("quotes").getUserType("price");
Assert.assertNotNull(priceType); // true
Assert.assertEquals("price", priceType.getTypeName()); // true
Assert.assertEquals(4, priceType.getFieldNames().size()); // AssertionFailedError: expected:<4> but was:<0>

I am testing with Cassandra v.2.1.2 on Windows using Datastax Java Driver 2.1.2.

I am thankful for any suggestions.

Regards
Andi

RE: Problems with user defined types (cql) and Datastax Java Driver

Posted by Andreas Finke <An...@solvians.com>.
Hi Alex,

I did so. Thanks for that hint.

Andi
________________________________
From: Alex Popescu [alexp@datastax.com]
Sent: 05 February 2015 18:14
To: user
Subject: Re: Problems with user defined types (cql) and Datastax Java Driver

Andreas,

Can you please post your question to the Java driver ml https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user as you'll have better chances to get an answer there.

thanks

On Thu, Feb 5, 2015 at 9:10 AM, Andreas Finke <An...@solvians.com>> wrote:
Hi,

I encountered the problem that in Java the Session does not create a valid UserType for my corresponding CQL user defined type.

CQL_SCHEMA:

create keyspace if not exists quotes
WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

CREATE TYPE IF NOT EXISTS quotes.price (
                value double,
                size bigint,
                timestamp bigint,
                delay int
);

JAVA

UserType priceType = session.getCluster().getMetadata().getKeyspace("quotes").getUserType("price");
Assert.assertNotNull(priceType); // true
Assert.assertEquals("price", priceType.getTypeName()); // true
Assert.assertEquals(4, priceType.getFieldNames().size()); // AssertionFailedError: expected:<4> but was:<0>

I am testing with Cassandra v.2.1.2 on Windows using Datastax Java Driver 2.1.2.

I am thankful for any suggestions.

Regards
Andi



--

[:>-a)

Alex Popescu
Sen. Product Manager @ DataStax
@al3xandru

Re: Problems with user defined types (cql) and Datastax Java Driver

Posted by Alex Popescu <al...@datastax.com>.
Andreas,

Can you please post your question to the Java driver ml
https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
as you'll have better chances to get an answer there.

thanks

On Thu, Feb 5, 2015 at 9:10 AM, Andreas Finke <An...@solvians.com>
wrote:

>  Hi,
>
>
>
> I encountered the problem that in Java the Session does not create a valid
> UserType for my corresponding CQL user defined type.
>
>
>
> CQL_SCHEMA:
>
>
>
> create keyspace if not exists quotes
>
> WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1
> };
>
>
>
> CREATE TYPE IF NOT EXISTS quotes.price (
>
>                 value double,
>
>                 size bigint,
>
>                 timestamp bigint,
>
>                 delay int
>
> );
>
>
>
> JAVA
>
>
>
> UserType priceType =
> session.getCluster().getMetadata().getKeyspace("quotes").getUserType("price");
>
> Assert.assertNotNull(priceType); // true
>
> Assert.assertEquals("price", priceType.getTypeName()); // true
>
> Assert.assertEquals(4, priceType.getFieldNames().size()); //
> AssertionFailedError: expected:<4> but was:<0>
>
>
>
> I am testing with Cassandra v.2.1.2 on Windows using Datastax Java Driver
> 2.1.2.
>
>
>
> I am thankful for any suggestions.
>
>
>
> Regards
>
> Andi
>



-- 

[:>-a)

Alex Popescu
Sen. Product Manager @ DataStax
@al3xandru