valchkou / cassandra-driver-mapping

JPA addon for DataStax Java Driver for Cassandra
58 stars 24 forks source link

BUG: Error in synching if Column Family has composite partition key with no clustering key #55

Closed nitinpadalia closed 9 years ago

nitinpadalia commented 9 years ago

Hi,

We're seeing error in auto schema sync API, if column family has composite partition key with no clustering key. Exception in thread "main" com.datastax.driver.core.exceptions.SyntaxError: line 1:105 no viable alternative at input ')' (...PRIMARY KEY((name,email),[)]...)

Here name and email are both part of partition key and no clustering column. Seems like a bug to me, or are we missing something?

-Nitin

valchkou commented 9 years ago

Nitin, please attach code sample for entity and key. I can't reproduce it

nitinpadalia commented 9 years ago

let me check my entity one more time, I'll get back to you

nitinpadalia commented 9 years ago

PFB Entity with its primary key and partition key:

@Table (name= "employee") public class Employee { @EmbeddedId private PrimaryKey key; private String age; public PrimaryKey getKey() { return key; } public void setKey(PrimaryKey key) { this.key = key; } public String getAge() { return "age"; } public void setAge(String string) { this.age = string; } }

public class PrimaryKey { @EmbeddedId private PartitionKey pk;

public PartitionKey getPk() {
    return pk;
}

public void setPk(PartitionKey partk) {
    this.pk = partk;
}

}

public class PartitionKey { private String name; private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }

valchkou commented 9 years ago

fixed. Please upgrade to latest ver 2.1.5