spring-data-couchbase

_class field and spring data couchbase

风格不统一 提交于 2019-12-23 21:20:58
问题 So, I was trying to find a way to remove/rename( and change the fields value ) the _class field from the document generated by spring data couchbase as the document is going to be stored by one service and in all likeliness be consumed by someone totally different. I was playing around with the api for spring couchbase and through a bit of trial and error found that I can rename the _class field with a custom value using the following way -> 1) Override the typeKey method in a class

SPRING4: Failed to read candidate component class CouchbaseConfig.class

六月ゝ 毕业季﹏ 提交于 2019-12-23 15:43:41
问题 I have a problem. I'm using Spring4 and i want to add a configuration to be able to use spring data couchbase and i have an error : org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/home/charlie/Desktop/Ultimate Projects/novare_dashboard/novare-project-dashboard/target/classes/hk/com/novare/dashboard/configuration/CouchbaseConfig.class]; nested exception is java.lang.annotation.AnnotationFormatError: Invalid default: public

How to use spring data with couchbase without _class attribute

徘徊边缘 提交于 2019-12-18 17:29:31
问题 Is there a simple way to use spring data couchbase with documents that do not have _class attribute? In the couchbase I have something like this in my sampledata bucket: { "username" : "alice", "created" : 1473292800000, "data" : { "a": 1, "b" : "2"}, "type" : "mydata" } Now, is there any way to define mapping from this structure of document to Java object (note that _class attribute is missing and cannot be added) and vice versa so that I get all (or most) automagical features from spring

Spring Data Couchbase (2.x) Document Relation

不问归期 提交于 2019-12-13 07:29:07
问题 I want to ask about spring data couchbase 2.x Can I refer a document in spring data couchbase like @DbRef annotation in spring data mongodb? 回答1: we implemented our persistence with mongo initially and are in the mode of switching to couchbase. Doing so, we're finding that referencing is highly relying on DBRef from mongo to perform relationships. This should be abstracted away and implemented outside of the underlying implementation. Same goes for searching, indexing, and the like. https:/

MappingInstantiationException with a BigInteger field in Spring Data Couchbase

旧巷老猫 提交于 2019-12-12 03:47:36
问题 I have an entity with a field of type java.math.BigInteger public class MyEntity { private String id; private BigInteger max; } I don't have any problem in storing the entity in DB using Spring Data JPA; but when I retrieve the entity, I am getting the following exception org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate java.math.BigInteger using constructor NO_CONSTRUCTOR with arguments BigInteger doesn't have a no-argument constructor. Is that a

Spring data couchbase 3.0.9 release - com.couchbase.client.java.error.ViewDoesNotExistException View person/all does not exist

扶醉桌前 提交于 2019-12-11 15:16:44
问题 I'm using Spring boot 2.0.4 with couchbase server (enterprise 5.5) as a docker container on my local machine. I have a configuration class which extends AbstractCouchbaseConfiguration , where I have provided the couchbase cluster/bucket details. The repository interface is annotated with @N1qlPrimaryIndexed and @ViewIndexed(designDoc = "person", viewName = "all") and my application.properties file has spring.data.couchbase.auto-index=true From what I understand, Spring boot should be able to

Can we Convert N1QL to shEL query for Spring use

爷,独闯天下 提交于 2019-12-11 13:42:47
问题 I am working on spring and couchbase and now want to upload data to couchbase with the help of my spring API but got to know that spring does not support N1QL, So is there any other way to achieve that or a shEL query insert into bucket1(key,value) values("Aman--12/04/1995", { "English":[{ "midterm": 34, "endterm": 67 }], "Maths":[{ "midterm": 20, "endterm": 40 }], "Computer":[{ "midterm": 48, "endterm": 90 }] }) UPDATE bucketName USE KEYS id SET arrayname = ARRAY_PUT(IFNULL(Arrayname[]),{

How are ids autogenerated in spring data couchbase?

冷暖自知 提交于 2019-12-11 06:58:38
问题 I want to create autogeneration of IDs to my documents in spring data couchbase. Spring docs has steps for this: https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.autokeygeneration Here is my code: @Document public class User { @Id @GeneratedValue(strategy = GenerationStrategy.USE_ATTRIBUTES, delimiter = ".") private String id; @IdPrefix(order=0) private String userPrefix; @IdSuffix(order=0) private String userSuffix; ... } I've a repository created for this:

Spring Data Couchbase Couldn't find PersistentEntity for type java.math.BigDecimal

ε祈祈猫儿з 提交于 2019-12-11 06:35:29
问题 I've hit the similar problem as described here: MappingInstantiationException with a BigInteger field in Spring Data Couchbase , so I've tried to workaround the problem with solution suggested by @Simon Baslé. I've added following custom converters: @Configuration @EnableCouchbaseRepositories @EnableCouchbaseAuditing public class CouchbaseConfig extends AbstractCouchbaseConfiguration { (...) @Override public CouchbaseCustomConversions customConversions() { return new

Couchbase & Spring query error: “Query returning a primitive type are expected to return exactly 1 result, got X”

对着背影说爱祢 提交于 2019-12-11 02:46:49
问题 In our spring-boot 2.0.4.RELEASE application, we are using Couchbase version 5.5.1 build 3511 with Spring . We added a new delete method to the Repository interface: public interface CatRepository extends CouchbaseRepository<Cat, String> { long deleteAllByName(String name); When calling the method, documents are deleted from the bucket, but we get the following error: Query returning a primitive type are expected to return exactly 1 result, got X The X value is changed according to the number