spring-data-cassandra

How can I ensure CassandraOperations.selectOneById() initializes all fields in the POJO?

房东的猫 提交于 2019-12-02 13:00:02
I'm using Spring Data Cassandra 1.3.4.RELEASE to persist instances of a class that I have. The class is written in Groovy, but I don't think that really matters. I have implemented a CrudRepository, and I'm injecting an instance of CassandraOperations into the repo implementation class. I can insert, delete, and do most of the other operations successfully. However, there's a scenario I'm running into which breaks my test case. My entity class looks something like this: @Table("foo") class FooData { @PrimaryKey("id") long id @Column("created") long updated @Column("name") String name @Column(

Build breaks when using cassandra entity with jodatime object

核能气质少年 提交于 2019-12-02 06:21:07
问题 I am setting up a small project with spring boot using spring-data-cassandra . I realized that my test breaks when I have joda time Datetime on a @Table object. Stack shows error like this: Caused by: org.springframework.data.cassandra.mapping.VerifierMappingExceptions: org.joda.time.Chronology: Cassandra entities must have the @Table, @Persistent or @PrimaryKeyClass Annotation My configuration is below: @Configuration @EnableCassandraRepositories(basePackages ="com.myproject.cassandra

How to configure neo4j and cassandra repositories in same spring boot application

风格不统一 提交于 2019-12-02 02:46:17
I have configured neo4j and cassandra repositories separately with spring boot using spring-data. However, when I try to use two repositories in the same projects it doesn't work as expected. This is my folder structure. -----org.test.project -----controller BarController FooController -----models -----dao -----cassandra BarDAO FooDAO -----neo4j BarDAO FooDAO -----repositories -----cassandra BarRepository FooRepository -----neo BarRepository FooRepository -----services CassandraService (Has cassandra repositories @Autowired) NeoService(Has neo repositories @Autowired) TestApp.java Note that

SET consistency level for Cassandra DDL

偶尔善良 提交于 2019-12-01 08:43:27
In my application logs I've seen that, by default, after running create/alter table statements, cassandra driver seems to do processing to bring schema into agreement for up to 10 seconds. Can I (and should I) set a consistency level for example 'quorum' while executing DDL statements like 'Create Table .. IF NOT EXISTS' to make sure my table gets created and propagated to all nodes? Schema changes (data definition) in Cassandra since 1.1+ are done via gossip . Since it uses Gossip, it is a separate read/write path than your typical data manipulation requests (SELECT, DELETE, INSERT, etc), and

IN clause with Spring Data and Cassandra @Query

折月煮酒 提交于 2019-11-30 13:10:21
I'm trying to query a Cassandra table using the IN clause and the @Query annotation from Spring Data. I have a table with a partition key of last_name and a clustering key of first_name. I have this query working @Query("SELECT * FROM people WHERE last_name=?0") public List<People> findByLastName(String lastName); and I would like to do something like @Query("SELECT * FROM people WHERE last_name=?0 AND first_name IN ?1") public List<People> findByLastName(String lastName, String[] firstName); I have it working using CassandraOperations.select("SELECT * FROM people WHERE last_name=" + lastName

Spring Data Cassandra LocalDateTime Conversion

大城市里の小女人 提交于 2019-11-30 10:10:56
I'm working on a project where we have an entity we want to persist with a field of type LocalDateTime, we know cassandra does not have native support for this type conversion, we've created our own custom converter using Spring's support for converters, however it seems Spring-Data-Cassandra is unable to either recognise them or understand that the field should be mapped to a column. This is how we've registered our converters with Spring's conversion service. <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"> <property name="converters">

Spark with Cassandra input/output

。_饼干妹妹 提交于 2019-11-30 07:28:18
Picture the following senario: A Spark application (Java implementation) is using Cassandra database to load, convert to RDD and process the data. Also the application is steaming new data from the database which are also processed by a custom receiver. The output of the streaming process is stored in the database. The implementation is using Spring Data Cassandra from the integration with the database. CassandraConfig: @Configuration @ComponentScan(basePackages = {"org.foo"}) @PropertySource(value = { "classpath:cassandra.properties" }) public class CassandraConfig { @Autowired private

IN clause with Spring Data and Cassandra @Query

荒凉一梦 提交于 2019-11-29 13:20:40
问题 I'm trying to query a Cassandra table using the IN clause and the @Query annotation from Spring Data. I have a table with a partition key of last_name and a clustering key of first_name. I have this query working @Query("SELECT * FROM people WHERE last_name=?0") public List<People> findByLastName(String lastName); and I would like to do something like @Query("SELECT * FROM people WHERE last_name=?0 AND first_name IN ?1") public List<People> findByLastName(String lastName, String[] firstName);

How to insert java.util.Date values into Cassandra date type column using Spring Data Cassandra?

只愿长相守 提交于 2019-11-29 11:08:41
I have cassandra table with a date type column as follows: create table people ( id int primary key, name text, email text, dob date ); I am using SpringBoot 1.5.2 + Spring Data Cassandra Starter. @Table("people") public class Person { @PrimaryKey Integer id; private String name; private String email; private java.util.Date dob; //setters and getters } public interface PersonRepository extends CrudRepository<Person, Integer>{ } I am inserting new Person as follows: personRepository.save(new Person(1, "Siva","siva@gmail.com", new java.util.Date())); It is throwing the following error: Caused by

How create table with spring data cassandara?

耗尽温柔 提交于 2019-11-29 07:14:41
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 creation something like BeanFactory and etc. :-) Overide the getSchemaAction property on the