on 11-15-2023 7:18 AM
I am trying to manager sub-entities with handlers. I use handlers on Insert/Upser events to operate in sub-entities. I will also need to handle Delete events. However, it seems i have no access to the deleted entity nor the id from the endpoint path in after event.
I do can get Cqn which is json format. Do i have to map to a HashMap and track all the way down to get an ID?
I am wondering how could i get that information from context. Thanks!
You can use the CqnAnalyzer to extract ID values from the CqnDelete statement, when using CAP Java.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
gregor.wolf: I updated the docs link, used an internal one by mistake.
spenceryang: I don't understand what you mean by passing it through context.setResult(). The CqnAnalyzer extracts ID values from the CqnDelete statement, which you can retrieve with context.getCqn() in an event handler. Setting a result in an Before or On event handler will skip CAPs default On event handler, which executes the deletion on the database.
|| Setting a result in an Before or On event handler will skip CAPs default On event handler, which executes the deletion on the database.
Great point to know.
What if i'd like to use the full deleted payload in @After event, where happens after delete event? I saw in another post that I'll have to somehow pass the entity from @Before event to request object. See: https://answers.sap.com/questions/13055368/cap-after-delete-event-handler-accessing-the-delet.html
User | Count |
---|---|
67 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.