Questions tagged [spring-data-couchbase]

Spring Data Couchbase project provides Spring Developers a POJO centric model for interacting with documents stored in Couchbase.

Developers use a Repository style data access pattern and Spring Data Couchbase adds query derivation based on N1QL (a superset of SQL), support for Spring configuration of the database client, and the ability to support the @Cacheable annotation building on the Spring Cache project.

Resources

Related tags

380 questions
3
votes
0 answers

Couchbase in Spring with default values when saving

We're using Couchbase database and Springboot, and we are facing an issue: we'd like to set a default value for a param of our model when it is going to be saved in database (as long as it hasn't already been set). Our model is something…
3
votes
1 answer

Converting a JsonDocument to its mapped entity

I use CouchbaseRepository in my project but sometimes I use lower level couchbase sdk methods to retrieve JsonDocument. Is there a way I can use spring-data-couchbase to convert a JsonDocument to lets say a User? This is all done internally in…
prettyvoid
  • 3,446
  • 6
  • 36
  • 60
3
votes
0 answers

Change name and value of attribute `_class` with Spring Data Couchbase

I changed the way that Spring Data Couchbase writes its _class attribute following this answer. Now, if I save an object of class com.package.entity.User, my document looks like: { ... "_type": "user" } My point is, when I use query methods…
Happy
  • 1,815
  • 2
  • 18
  • 33
3
votes
1 answer

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

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…
haoudoin
  • 151
  • 10
3
votes
2 answers

spring-data-couchbase throws DocumentDoesNotExistException for non-existent documents

I am using spring-data-couchbase 2.1.2 with spring-boot 1.4.0.RC1 and couchbase-spring-cache It works fine when caching is disabled as it returns NULL object When caching is enabled and try to find a non-existing document in the bucket it throws an…
3
votes
1 answer

How to fetch a field from document using n1ql with spring-data-couchbase

This is the query in the repository which works fine. public interface PlayerRepo extends CrudRepository{ @Query("#{#n1ql.selectEntity} WHERE code = $1 and #{#n1ql.filter}") public List findPlayersWithCode(String code); } I…
mickygo
  • 107
  • 1
  • 10
3
votes
1 answer

Reading a byte array from couchbase in Spring

I have a simple Object that I am trying to read/write into couchbase (using spring data). Here is the object: @Document public class CacheObject { @Id private String id; private byte[] data; public String getId() { return id; } …
KevinK
  • 33
  • 4
2
votes
1 answer

How to sort documents by value of json object in couchbase query?

I have the below kind of data stored in my collection called persons, I am using spring-data-couchbase for reading this data in Java POJOs, and I am using the @Query annotation in my PersonsRepository class and writing SQL query for fetching data…
axnet
  • 5,146
  • 3
  • 25
  • 45
2
votes
2 answers

how to write a nested couchbase query which returns count and list of objects in spring data couchbase reactive?

I have below query written in my spring data reactive couchbase repository class using @Query annotation WITH subquery1 AS ( SELECT COUNT(*) AS total_count FROM bucketName WHERE condition1 ), subquery2 AS ( SELECT name, address, email FROM…
axnet
  • 5,146
  • 3
  • 25
  • 45
2
votes
1 answer

SpringDataCouchbase - Not able to save map with collection as value

Tried to save Person entity with below attributes in couch base, but not able to save getting error, see below error log. Note: Issue in Spring boot 3.X onwards, Spring-data -couch 5.X onwards not facing in 4.X I see call of method…
2
votes
1 answer

Java thread that upserts document in Couchbase is stuck in Waiting state indefinitely

Spring Boot Version: 2.3.1.RELEASE Spring Data Couchbase: 4.3.5 Couchbase Java Client: 3.2.7 My spring boot application is getting stuck after inserting a document in Couchbase. (I can see document was inserted successfully) ` final CatalogLock…
Neha Sahni
  • 31
  • 1
2
votes
2 answers

Update Couchbase documents without overwriting @Created fields with Spring Data Auditing

I have a Couchbase document for which I'd like to enable auditing: @Document(expiry = 0, expiryUnit = TimeUnit.DAYS, touchOnRead = true) public class Entity { @Id @GeneratedValue(strategy = GenerationStrategy.USE_ATTRIBUTES, delimiter =…
FerdTurgusen
  • 320
  • 5
  • 13
2
votes
2 answers

What are the solutions for com.couchbase.client.java.query.dsl.Sort issue?

This is one of error getting class, import com.bookingsite.acme.config.document.paymentoption.PaymentGatewayConfiguration; import com.bookingsite.acme.config.dto.paymentgatewaysearchrequest.PaymentGatewayConfigSearchRequestDTO; import…
gimhanas
  • 69
  • 5
2
votes
1 answer

Why @Query annotation not working to SpringBoot Version 2.7.4 CouchbaseRepository?

I Upgraded Project to SpringBoot Version 2.2.0.RELEASE to 2.7.4.This is the example Repository Interface. import com.flyaero.aeromasterapiservice.data.AddLanguageRequest; import…
gimhanas
  • 69
  • 5
2
votes
2 answers

How to search by field in embeded list of objects using Spring repository for Couchbase

I have following User Document: @Document @Data public class User { @Id @GeneratedValue(strategy = GenerationStrategy.UNIQUE) private String id; @Field private String email; @Field private String fullName; @Field …
eternal
  • 339
  • 2
  • 15