on ‎2021 Oct 13 6:14 AM
Hi Cap team,
Could you analyze when we execute an db statement using cap service in java as below:
@Autowired
PersistenceService persistenceService
CqnUpsert upsert = Upsert.into(GTTMetadataStatus_.class).entries(statusList);
persistenceService.run(upsert);
And when run above, it caused an error: Connection must not be in auto-commit mode
Do you know the reason, and how I can resolve this issue?
Request clarification before answering.
marcbecker,
We did not use PlatformTransactionManager. We just use persistenceService.run(upsert);
And in application.yaml:
spring:
profiles: cloud
cds:
dataSource:
serviceName: ${TARGET_CONTAINER}
binding: ${TARGET_CONTAINER}We use that. Do you know the reason?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This usually happens in case CAP Java is not configured with the correct PlatformTransactionManager from Spring. Do you explicitly create (multiple) instances of PlatformTransactionManager in your application? If yes pleae make sure that the primary PlatformTransactionManager manages the primary DataSource, as those are the two instances that are used by CAP Java.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No. Do you have usages of these classes in your project?
Do you have multiple datasource bindings? For example multiple HANA bindings? Or HANA bindings and service-manager bindings?
| User | Count |
|---|---|
| 10 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.