Skip to content

Fix queries to conditionally include IsActiveEntity for non-draft entities - #568

Merged
PujaDeshmukh17 merged 5 commits into
Release_v1.9.4from
RBSDMS-NoActiveEntityFix-feature
Aug 13, 2026
Merged

Fix queries to conditionally include IsActiveEntity for non-draft entities#568
PujaDeshmukh17 merged 5 commits into
Release_v1.9.4from
RBSDMS-NoActiveEntityFix-feature

Conversation

@PujaDeshmukh17

@PujaDeshmukh17 PujaDeshmukh17 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

Updated DBQuery.java to conditionally include the IsActiveEntity column in CQL queries only when the field is present on the attachment entity, preventing runtime errors for non-draft entities that don't have this field.
Added unit tests to DBQueryTest.java covering both the IsActiveEntity-present and IsActiveEntity-absent paths for all three affected query methods.

Problem

Queries in getAttachmentsForUPID, getAttachmentsForUPIDAndRepository, and getAttachmentsForFolder unconditionally selected IsActiveEntity as a column. For entities that are not draft-enabled (i.e., do not have an IsActiveEntity element in their model), this caused an "element does not exist" error at runtime.

Changes

getAttachmentsForUPID — Checks attachmentEntity.findElement("IsActiveEntity").isPresent() before including IsActiveEntity in the column list.
getAttachmentsForUPIDAndRepository — Same conditional check applied.
getAttachmentsForFolder — Both the draft table query and the active entity fallback query now independently check for IsActiveEntity presence before including it (draftHasIsActiveEntity / activeHasIsActiveEntity).

Any documentation

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist before requesting a review

  • I follow Java Development Guidelines for SAP
  • I have tested the functionality on my cloud environment.
  • I have provided sufficient automated/ unit tests for the code.
  • I have increased or maintained the test coverage.
  • I have ran integration tests on my cloud environment.
  • I have validated blackduck portal for any vulnerability after my commit.

Upload Screenshots/lists of the scenarios tested

  • I have Uploaded Screenshots or added lists of the scenarios tested in description

Comment thread sdm/src/test/java/unit/com/sap/cds/sdm/persistence/DBQueryTest.java
Comment thread sdm/src/main/java/com/sap/cds/sdm/persistence/DBQuery.java Outdated
Comment thread sdm/src/main/java/com/sap/cds/sdm/persistence/DBQuery.java Outdated

@akgarg06 akgarg06 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PujaDeshmukh17
PujaDeshmukh17 merged commit affabbc into Release_v1.9.4 Aug 13, 2026
1 check passed
@PujaDeshmukh17
PujaDeshmukh17 deleted the RBSDMS-NoActiveEntityFix-feature branch August 13, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants