I use spring-data-couchbase to retrieve couchbase, connect with bucket.
However, whenever the programme first time retrieve this object, it never success, must retrieve the second time than could get the document from couchbase.
You are describing a consistency issue here. If you want consistent data you need to specify it in your request. If you are using the first version of SpringDataCouchbase you can do it like
For entity class, @Document
public class Aaa { @Id private String column1;
…
For repository
public interface AaaRepository extends CrudRepository<Aaa, String> {
For config class, is: @Configuration @EnableCouchbaseRepositories(“correct repository package”) @EnableConfigurationProperties(CouchbaseConfiguration.class)
public class CouchbaseConfig extends AbstractCouchbaseConfiguration {
For service class, call like:
final Iterable payments = AaaRepository.findAll();
===========================================================================
Like that, then the problam appear: When first time programe read one object, data is not consistence, and get the correct object status after the second time query, but two queries are exactly the same
I use Repository, which all in standard:1) For entity class,@Documentpublic class Aaa { @Id private String column1;.
For repositorypublic interface AaaRepository extends CrudRepository {
For config class, is:@Configuration@EnableCouchbaseRepositories(“correct repository package”)@EnableConfigurationProperties(CouchbaseConfiguration.class)public class CouchbaseConfig extends AbstractCouchbaseConfiguration {
For service class, call like:final Iterable payments = AaaRepository.findAll();===========================================================================
Like that, then the problam appear: When first time programe read one object, data is not consistence, and get the correct object status after the second time query, but two queries are exactly the same
Just one tiny thing:
ViewQuery viewQuery = ViewQuery.from(“customer”, “all”); //we assume that there is a class named Customer.class here
Would you tell me how “customer” and “all”, these two value come from?
is it only because there is a class Customer.class, thus its name is “customer”?
and how about “all” ?
The design document name customer is indeed the lower case Class name.
The repository has a findAll method, so the view backing up this method is called ‘all’.
If you add the findSomething method in the repository, the view will need to be names ‘something’.
Note that all of these has been simplified with Spring Data Couchbase 2.