on ‎2022 Nov 07 4:27 AM
In the after create event handler of an entity (FundsAllocationReport), I am performing some logic and creating some data to insert into a table associated with the entity (CustomerClaims). As part of the payload in the INSERT statement I provide the ID of the recently created entity (FundsAllocationReport).
What is happening is, intermittently, CAP is throwing ASSERT_REFERENCE_INTEGRITY error on the ID.


Above is data sent by After create handler

The same ID returned by After create handler is not in the database??? How is this possible??
Here also is the data model:

This must be framework bug?? CAP fires the after event on create before the entity is created on the database??
Request clarification before answering.
Hi,
Replace Association by Composition (https://cap.cloud.sap/docs/cds/cdl#associations). My guess is the data hasn't been committed to the database yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 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.