spring-data-couchbase

MappingException for Map type of data

别来无恙 提交于 2021-01-03 08:30:29
问题 While saving Map type data in couchBase I am getting an exception Caused by: org.springframework.data.mapping.MappingException: Couldn't find PersistentEntity for type java.lang.Object! I've taken a map in DataModel @Data public class test { private Map<String,Object> testMap; } I found this and override couchBase configuration to do customMapping in case of Object Type like protected <R> R read(final TypeInformation<R> type, final CouchbaseDocument source, final Object parent) { if (Object

MappingException for Map type of data

こ雲淡風輕ζ 提交于 2021-01-03 08:30:03
问题 While saving Map type data in couchBase I am getting an exception Caused by: org.springframework.data.mapping.MappingException: Couldn't find PersistentEntity for type java.lang.Object! I've taken a map in DataModel @Data public class test { private Map<String,Object> testMap; } I found this and override couchBase configuration to do customMapping in case of Object Type like protected <R> R read(final TypeInformation<R> type, final CouchbaseDocument source, final Object parent) { if (Object

Where is `_class` built in Spring Data Couchbase when using 'findBy' methods?

南笙酒味 提交于 2020-07-21 07:38:07
问题 Which classes in Spring Data can I extend/override to have the where-clause include the classes that inherrit the base entity/model? To elaborate.... Here are a few models that extends from a "base" Activity class: @Document public abstract class Activity { } @Document public class CommentActivity extends Activity { } @Document public class ShareActivity extends Activity { } When saving these models, I am using a single repository class as define below with a "findBy" method: @Repository(

How to capture save or update events in Couchbase

Deadly 提交于 2020-07-20 08:51:59
问题 I would like to be able to do some data manipulation when documents are updated or created in Couchbase. Documents can arrive in our database either via Sync Gateway or our own code which streams data in from an http service. It would be great to have one place where I can intercept all updates. We are running a Spring Boot REST API against this data so this would be the good place to have the interceptor/listener. Either way my preference would be for a Java solution. The data is written as

@Id and @Field on same variable?

放肆的年华 提交于 2020-01-04 05:41:17
问题 Is there a way to achieve @Id and @Field on the same variable of a @Document so the variable is also saved inside the document? I'm trying to preserve the data I'm importing as much as I can, even though I get the design practices followed by the developers. 回答1: The @Id annotation will take priority over @Field, so no the id cannot be persisted as both document ID and value inside the document. Quickest way to achieve that is probably to duplicate the id field as a separate @Field annotated

Couchbase view on multiple columns with WHERE and ORDER BY clause as in SQL

我是研究僧i 提交于 2020-01-02 17:54:31
问题 I am new to Couchbase noSql database. I am trying to create a view, i want this view should give result as below SQL query. SELECT * FROM Employee e WHERE e.name = "DESM%" AND e.salary < 1000 ORDER BY e.id desc Any suggestion is very appreciated. 回答1: If you look at existing beer samples in Couchbase (it comes with it), you will find views defined there. In admin console you can run a view. Notice when you run a view you can provide filtering criteria and sort order for the result...that

Couchbase document id generation

做~自己de王妃 提交于 2019-12-24 17:26:16
问题 I have an Springboot application integrated with couchbase 6.0. I have read that if a key is annotated with @Id then it will saved as an document id and will not be a part of the json. Then i have used @Id and @Field together on the key but still that field is not appearing on json document. Can somebody help me out on the following: 1: How to make same key as document id and keep that a part of json also. 2: If a field is declared with @Id, it is created as document id and does not appear on

SpringBoot Couchbase Integration

为君一笑 提交于 2019-12-24 06:48:49
问题 I want to make a filterable list of my UserTask entity with the QueryDslPredicateExecutor interface, so the parameters given in the query string will be autoprocessed into a Predicate. I have the following classes/interfaces public interface UserTaskQuerydslRepository extends CrudRepository<UserTask, String>, QueryDslPredicateExecutor<UserTask>, QuerydslBinderCustomizer<QUserTask> { @Override default void customize(QuerydslBindings bindings, QUserTask userTask) { ... } } UserTask is my class

Using IN clause in couchbase N1Ql @query or use findAll(keys) from couchbase JPA

点点圈 提交于 2019-12-24 06:30:51
问题 I am using Spring couchbase JPA and trying to fetch documents by giving a list of keys. My repository structure looks something like public interface EmployeeRepo extends CouchbasePagingAndSortingRepository<Employee, String>, EmployeeCustomRepo { I have a list of employee ids to search for and fetch the corresponding document. I tried using the method from curdRepository public List<Employee> findAllById(List<String> empIds) { return employeeRepo.findAll(empIds); } But I get exception as::

_class field and spring data couchbase

巧了我就是萌 提交于 2019-12-23 22:01:06
问题 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