spring-data-cassandra

CassandraOperations ingest not writing complete list

心已入冬 提交于 2020-01-07 02:36:11
问题 I am trying to build high speed insert/delete in a cassandra database but a fourth of the data is not getting inserted. When using Spring Repository.save(List) everything is good (but catastrophic in terms of CPU usage) so I tried the provided CassandraOperations.ingest() (or CQLOperations.ingest()). When dealing with small amount of data everything goes fine, but when I get to several hundreds of records, I start losing data. Here is an extract of the insert code: private final String

Mapping cassandra list<frozen<list<int>>> field to Java in spring-data-cassandra

拈花ヽ惹草 提交于 2020-01-05 06:28:36
问题 can someone point to me how a field declared list<frozen<list<int>>> can be mapped back into java in spring-data-cassandra. I'm able to simply save data through List<List<Integer>>> but doesn't work when reading from the database, a codec not found exception pops. Help is much appreciated. 回答1: Your Declaration is correct. But for nested collection read you need to create Custom RowMapper to convert row to DTO. Example : Let's we have the table ctest CREATE TABLE ctest ( id int PRIMARY KEY,

Mapping cassandra list<frozen<list<int>>> field to Java in spring-data-cassandra

五迷三道 提交于 2020-01-05 06:28:03
问题 can someone point to me how a field declared list<frozen<list<int>>> can be mapped back into java in spring-data-cassandra. I'm able to simply save data through List<List<Integer>>> but doesn't work when reading from the database, a codec not found exception pops. Help is much appreciated. 回答1: Your Declaration is correct. But for nested collection read you need to create Custom RowMapper to convert row to DTO. Example : Let's we have the table ctest CREATE TABLE ctest ( id int PRIMARY KEY,

How create table with spring data cassandara?

半城伤御伤魂 提交于 2019-12-29 07:03:31
问题 I have created my own repository like that: public interface MyRepository extends TypedIdCassandraRepository<MyEntity, String> { } So the question how automatically create cassandra table for that? Currently Spring injects MyRepository which tries to insert entity to non-existent table. So is there a way to create cassandra tables (if they do not exist) during spring container start up? P.S. It would be very nice if there is just config boolean property without adding lines of xml and

How can we stop spring boot data cassandra from connecting to localhost?

南楼画角 提交于 2019-12-25 08:25:11
问题 We are using Spring data - cassandra and when we run the application without providing configuration, spring boot tries to connect to localhost. Is there a way to stop spring boot from auto connecting? Thanks in advance :) 回答1: You have multiple ways to achieve that but none of them is just a boolean flag: Remove the Cassandra dependency, if you can afford dependency exclusion Provide @Lazy Session / CassandraTemplate @Bean 's yourself: @Configuration public class MyCassandraConfiguration

Unable to connect to Cassandra cluster running on local host

早过忘川 提交于 2019-12-25 07:32:33
问题 I have setup datastax cassandra service and have created a keyspace and my db is running fine. Below are output from the nodetool status command: C:\Users\xxx>cd C:\Program Files\DataStax Community\apache-cassandra\bin C:\Program Files\DataStax Community\apache-cassandra\bin>nodetool status Datacenter: datacenter1 ======================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 127.0.0.1 229 KB 256 100.0% d5229669-f8f2-4b06

Cassandra entities must have the @Table, @Persistent or @PrimaryKeyClass Annotation

无人久伴 提交于 2019-12-24 14:04:27
问题 I am working on spring boot application and trying to connect with Data Stax Cassandra. Below is the I have written. package com.sampleProj.dto; import java.io.Serializable; import java.sql.Blob; import java.sql.Timestamp; import org.springframework.data.cassandra.mapping.Column; import org.springframework.data.cassandra.mapping.PrimaryKey; import org.springframework.data.cassandra.mapping.Table; @Table public class Inbound implements Serializable{ @PrimaryKey private int transactionalId;

Paging SELECT query results from Cassandra in Spring Boot application

允我心安 提交于 2019-12-24 07:57:07
问题 During my research I have come across this JIRA for Spring-Data-Cassandra: https://jira.spring.io/browse/DATACASS-56 Now, according to the post above, currently SDC is not supporting Pagination in the Spring App due to structure of Cassandra. However, I'm thinking, if I can pull the entire rows list into a Java List, can I Paginate that list ? I don't have much experience in Spring, but is there something I am missing when I assume this can be done ? 回答1: Cassandra does not support pagination

Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Expected 8 or 0 byte long for date (13)

混江龙づ霸主 提交于 2019-12-23 17:33:15
问题 I am trying to insert data with spring-data-cassandra. But I am getting bellow error , when my app is running with SpringBoot(version is 1.5.3) I add a custom CallHistoriyRespority object implemented CrudResposity in spring-data, and use the save method to insert the data object I can't find any reason and the problem confused me Full stack trace : Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Expected 8 or 0 byte long for date (13) at com.datastax.driver.core

TTL support in spring boot application using spring-data-cassandra

大兔子大兔子 提交于 2019-12-23 10:15:20
问题 I am trying to add TTL to each column while insertion and update data using spring boot applicaiton. For this i am using spring-data-cassandra 1.1.3.RELEASE For this i had written one interface CustomTTLRepository: @NoRepositoryBean public interface CustomTTLRepository<T, ID extends Serializable> extends TypedIdCassandraRepository<T, ID> { <S extends T> S save(S s, int ttl); } Implementation CustomTTLRepositoryImpl: @NoRepositoryBean public class CustomTTLRepositoryImpl<T, ID extends