Skip to content

[Version: 2.2.2] Error on delete cascade of attachments #268

@vlovini

Description

@vlovini

Describe the bug
When deleting a parent entity (e.g., Books), CAP correctly deletes the child entities (in this case, the Books_Attachments). However, the handler responsible for deleting the corresponding attachment in AWS is not triggered. This appears to be due to an incorrect entity path resolution.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Book entity and attach files to it.
  2. Delete the Book entity.
  3. Observe that the child entities are deleted, but the AWS attachment remains.

Expected behavior
The AWS attachment linked to the deleted entity should also be removed automatically by the handler.

[ ] Is it a regression issue?
Yes, this behavior deviates from expected cleanup logic and may be a regression.

Screenshots
Please attach any relevant screenshots or logs showing the failed deletion or entity path mismatch.

Customer Info
Company: SAP


Additional Notes

  • The issue seems to stem from a mismatch in entity naming conventions:
    • OData service uses entity names ending with _ - e.g. BooksOData.Books_attachments
    • Table definitions use . at it last part - e.g. sap.books.Books.attachments
  • A temporary fix was implemented in a separate branch link, but it lacks tests and is not considered a final solution.
  • Suggestion: Avoid hardcoded entity names. Instead, consider using intermediary entities with aspects or compositions.

Example Entity Structure:

entity Books {
  ...
  attachments : Composition of many BooksAttachments on attachments.book = $self;
}
entity BooksAttachments : Attachments {
 task: Association to one Books;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions