0
votes

I am using kundera 2.4 as my JPA interacton with Cassandra .

Created Column family in cassandra

create column family usageitem  with key_validation_class = 'UTF8Type'
 and comparator = 'UTF8Type' ;

The default validation class assumed by cassandra for a column is BytesType . I want to change it to UTF8Type via jpa entity

I do not want to change the above column definition to

create column family usageitem  with key_validation_class =
 'UTF8Type' and comparator = 'UTF8Type' and default_validation_class =
 'UTF8Type' ;

because i do not want to touch my existing database definition

My JPA entity is looking something like this -

@Entity
@Table(name = "usageitem", schema = "TITAN@TROYUnit")
public class UsageItem {    

@Id
@Column(name="record_id")
private String recordID;

@Column(name="provider_name",columnDefinition="UTF8Type")
private String providerName;

//Setters & Getters ....

}

So how should i specify the validation type of cassandra column value in the above JPA entity to insert data in utf8 or text format ?

1

1 Answers

0
votes

First, i will suggest to upgrade for 2.6 release.

Second, ideally data type should be in sync with Cassandra data types. if it is BytesType, it should be of type byte or byte.

Also, Can you please share the error you getting if column values are defined as "String" in jpa entity while those are BytesType in Cassandra?

-Vivek