-
Notifications
You must be signed in to change notification settings - Fork 192
Fix sample transaction code. was: Difference save entity between using repository and transaction #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Before I go into investigating the differences - couchbase-transactions are directly supported in spring-data-couchbase in 5.0.0-M5 It's not necessary to do the conversion. [ the doc is staged at https://mikereiche.github.io/staged/ and will be in the next release which should be in the next couple weeks ] There are instructions on how to use a SNAPSHOT at https://docs.spring.io/spring-data/couchbase/docs/5.0.0-M5/reference/html/ (just use milestone instead of snapshot and use M5). |
you need to use target.export instead of target.content to get the correct serialization. |
Thanks a lot for your suggestion, it's indeed working fine with I took this code from spring data couchbase documentation, which gives an example using the target.content instead. Perhaps the documentation needs to be updated while waiting for the 5.0.0 to be released
I also tried to use the 5.0.0-M5 and I'm facing this exception (it's same with the snapshot one) : @Service
class ScheduleService(
private val reactiveOperations: ReactiveCouchbaseOperations
) {
@Transactional
fun saveScheduleWithTransaction(schedule: Schedule): Mono<Schedule> {
return reactiveOperations.insertById(Schedule::class.java).one(schedule)
}
}
|
I'll see if I can eliminate that block(). I'm curious how this code is being called as you had a similar issue with #1516 and I haven't been able to reproduce it. (I did provide a fix for #1516 which eliminates the block()). I opened #1527 for the exception in M5. |
* fix transaction sample fixes #1524 * delete new line
Hello,
I was playing with transactions provided by couchbase and spring data following the documentation from here
I noticed that there's a difference if I persist a document with a repository or with a transaction.
Here are details :
spring-boot 2.7.2
couchbase-transactions 1.2.4
Simple entity
Repository
Service
Here are differences :
As you can see, inserting the document with a transaction adds extra fields to the document :
content
,id
andexpiration
(all innested
). Shouldn't it be in root object instead ?Furthermore, my simple list of string is not converted into an array with the actual String value.
If I convert my List into an Array in my data class, result is same when using a transaction.
Did I miss something ?
The text was updated successfully, but these errors were encountered: