Version property working fine but not being saved in Couchbase - spring

We are developing an API server with spring boot, and we are using Couchbase as database.
We have an entity that has the following property:
#Version
#Field("version")
private long version;
The goal of this property is to handle CAS issues when saving an instance to couchbase. This is working fine, however, I don't see that property when I take a look at the Couchbase panel (the stored document doesn't have it). How is that possible? Shouldn't that version be stored as a property of the json?
Thanks a lot

Related

How to configure maxDegreeOfParallelism for cosmosdb in Springboot?

I want to configure the CosmosQueryRequestOptions.maxDegreeOfParallelism while using the CosmosRepository. I didn't find any documentation around it.
This blog shows how to configure and use this setting through a custom client, but I want to use the repository instead. https://medium.com/#middha.nishant173/improve-query-performance-with-azure-cosmosdb-java-sdk-v4-db1fc54cb484
CosmosQueryRequestOptions is implementation detail for Spring Data Cosmos SDK, so customers cannot set it through spring application.
This can be implemented as a new feature, and can be exposed through application.properties via query.maxDegreeOfParallelism - which customers can opt in if they want.
Default value for maxDegreeOfParallelism is 0, which is the right value for single partition queries. For cross partition queries in the current SDK version, you can get the cosmosClient through spring boot applicationContext and run the query directly against the client. This example shows how to do it - https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/PageableAddressRepositoryIT.java#L144

Spring Boot Elasticsearch and #JsonProperty

After migrating an app from Spring Boot 2.06 to 2.1.9, all properties marked with #JsonProperty stopped being indexed. Since they are not being indexed using properties's names it looks like Spring Data ES is using annotations to create the data sent to ES but the schema created is not.
I've read somewhere #JsonProperty are not supported after Spring Data ES 6.2 (or something) but, if that's the case, how should I do now to index these fields using a different name?
I also noticed newer versions enable #Field to set the name but it's not the case in SB 2.1.9 and, besides that, I also have some get methods marked with #JsonProperty.
Is it really expected to stop working? If so, what's the approach now? If not, What should I check to fix it?

Text search with Spring Data Redis

I am trying to find documentation around creating and searching a text index on redis using Spring Data. I see #Indexed but dont find #TextIndexed like with Spring data MongoDB.
https://github.com/RedisLabs/JRediSearch
There's no Redis module support in Spring Data Redis and we don't plan to add support for Redis modules.

Can someone provide me an example for Spring Data Couch Base 2.x client to store and retrieve data in Key Value format from couch base server?

My current project uses spring data couch base 1.2.3 Release version where CouchBaseClient object will be there to retrieve save/get data in key value format from couch base server/cluster/bucket. Now we are planning to upgrade spring data couch base version to 2.x, but CouchBaseClient object has been deleted in 2.x instead bucket/cluster beans are available. Bucket object doesn't have any APIs/methods to save/get data in key value format [ i might be wrong, not sure] so request to help me to find out how to proceed further is there a way in 2.x to store data in key value format?
we have plans to upgrade spring boot version to 1.4.4.release as well so if there are any others ways to interact easily with couch base server, please let me know.
My project env info:
Spring boot 1.2.3
Java 1.8
Thanks,
Satish
This is more a factor of the underlying SDK being of a different generation (2nd generation of Couchbase SDKs, where most methods align in all languages/SDKs and the whole API has been made more coherent).
This generation of SDK exposes objects closer to the reality of the Couchbase cluster: Cluster object to connect to the nodes and perform cluster-wide operations, then Bucket to perform data operations.
Spring Data Couchbase 2.x builds on that. In your configuration you'll choose which Bucket to use (see the docs) and as such you'll also be able to inject that Bucket instance if you really need to.
Note that Spring Data Couchbase offers several layers of abstraction on top of the SDK: repositories for CRUD operations around an entity type, then CouchbaseTemplate that offers individually typed operations but is still capable of marshalling to JSON (the SDK is accessible from CouchbaseTemplate).
On the other hand, with the SDK you have to marshall to JSON yourself, either as a JsonObject map-like structure (default) or a String (in which case you need to store and retreive a RawJsonDocument). Working with these Document types is all explained in the SDK's documentation.

Detached objects in standalone Java SE Client: Netbeans uses autogenerated DTOs?

I have a problem:
I am working at a Java EE project, the GUI is writting by other persons.
I cretaed the database
I wrote a Java SE application (with Netbeans 7.1) which contains the entities (I let Netbeans generate these from database and fitted them)
I wrote the testclasses, wrote the ejbs and tested them.
I than wrote a singleton webservice in which the other beans are injected.
I the webservice, I got the expected result: it's possible to get the list of all instances (rows in the database), get an instance of an instance by ID, update and save it: all CRUD operations are OK.
In the Client, a Java SE Application (with Netbeans 7.1), I added a "web service client" by specifying the WSDL URL (of the webservice created in 6).
All what I got are detached objects. Every object with its all fields (as strings) EXCEPT THE ID (Primary Key).
instead of an update, I got an insert (cause the edited object has no ID on the client).
Remove doesn't work at all.
Other operations (findAll, findById) are OK.
Do I have to use DTOs (Data Transfer Objects)? I read that these are not more needed as of ejb3.1
On the client, for a findAll operation, Netbeans does not accept to use the entities: it forces me to use the autogenerated "dtos", which have almost the same fileds (except thhe primary key or ID) as the entities but as strings.
Problem solved.
I don't know why but Netbeans has autogenarted DTOs without the primary keys, therefore not all CRUD were possible.
This took me a long time and caused lot of headache!
Meziane

Resources