Skip to content

TRUNK-5891: ProgramWorkflowState Domain - Switching from Hibernate Mappings to Annotations#5792

Open
Chinmay7070 wants to merge 12 commits intoopenmrs:masterfrom
Chinmay7070:TRUNK-5891-migrate-programworkflowstate
Open

TRUNK-5891: ProgramWorkflowState Domain - Switching from Hibernate Mappings to Annotations#5792
Chinmay7070 wants to merge 12 commits intoopenmrs:masterfrom
Chinmay7070:TRUNK-5891-migrate-programworkflowstate

Conversation

@Chinmay7070
Copy link
Contributor

Description of what I changed

This PR migrates the ProgramWorkflowState entity from Hibernate XML mapping (HBM) to JPA annotations as part of the ongoing JPA migration effort in OpenMRS core.
Changes:

  • Added JPA annotations to ProgramWorkflowState entity
  • Configured appropriate @entity, @table, @id, @manytoone, and @column mappings
  • Retained inheritance from BaseChangeableOpenmrsMetadata
  • Removed ProgramWorkflowState.hbm.xml
  • Updated hibernate.cfg.xml to remove XML mapping reference
  • Added required Liquibase update for metadata-related columns
  • Updated DatabaseUpdaterDatabaseIT change set count accordingly

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-5891

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@Chinmay7070 Chinmay7070 force-pushed the TRUNK-5891-migrate-programworkflowstate branch from 5a6aaf5 to 59101d7 Compare February 13, 2026 13:04
@Chinmay7070 Chinmay7070 force-pushed the TRUNK-5891-migrate-programworkflowstate branch 2 times, most recently from 298fcf5 to 4d8b86e Compare February 14, 2026 16:20
@Chinmay7070 Chinmay7070 force-pushed the TRUNK-5891-migrate-programworkflowstate branch 2 times, most recently from ecc05bb to 64402d8 Compare February 16, 2026 10:45
@Chinmay7070
Copy link
Contributor Author

Hi @dkayiwa,

All tests are passing successfully on my local machine. However, they are failing on the CI side. Could you please help me understand what might be causing this difference?

Thank you.

@dkayiwa
Copy link
Member

dkayiwa commented Feb 16, 2026

@Chinmay7070 the failing test has just been fixed in core. Did you take a look at the new sonar issue?

@Chinmay7070
Copy link
Contributor Author

@dkayiwa please review when you got chance.

--failOnCVSS 6.2
--enableRetired
--suppression dependency-check-suppressions.xml
--nvdApiKey ${{ secrets.NVD_API_KEY }}
Copy link
Member

Choose a reason for hiding this comment

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

Is this related to the ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @dkayiwa,

No, this is also not related to TRUNK-5891. I removed the --nvdApiKey line because it was causing the OWASP Dependency Check workflow to fail on fork PRs .
However, if this change should not be part of my PR, I can revert it. Please let me know.

Copy link
Member

Choose a reason for hiding this comment

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

Can we also discard this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I’ll discard this change and update the PR shortly.

ancestors.add(obs);
for (Obs child : obs.getGroupMembers()) {
validateHelper(child, errors, ancestors, false);
for (Obs child : obs.getGroupMembers(true)) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this related to the ticket?

Copy link
Contributor Author

@Chinmay7070 Chinmay7070 Feb 18, 2026

Choose a reason for hiding this comment

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

Hi @dkayiwa,

No, the ObsValidator.java changes are not related to TRUNK-5891. My branch was created before this fix was merged to master, which is why it's showing as a change in the diff. I have now synced my branch with the latest upstream master, so ObsValidator now matches the current version.

Copy link
Member

Choose a reason for hiding this comment

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

So can you remove these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes @dkayiwa, done! I've synced with upstream/master and removed the ObsValidator changes from this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Kindly a space is needed after a comma please!

Suggested change
@AttributeOverride(name = "name",column = @Column(name = "name", nullable = true, length = 255))
@AttributeOverride(name = "name", column = @Column(name = "name", nullable = true, length = 255))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @jwnasambu
I will add the space after the comma.

@Chinmay7070 Chinmay7070 force-pushed the TRUNK-5891-migrate-programworkflowstate branch from 6168a94 to e396ffe Compare February 18, 2026 17:16
Copy link
Contributor

Choose a reason for hiding this comment

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

Kindly fix the comment reference to something like this:

Suggested change
<comment>Add audit columns required by Order JPA mapping for TRUNK-5891</comment>
<comment>Add audit columns required by ProgramWorkflowState JPA mapping for TRUNK-5891</comment>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @jwnasambu for the review!
the comment should reference ProgramWorkflowState, not Order. I will fix this along with the spacing issue.

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.01%. Comparing base (17479a2) to head (1328811).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5792      +/-   ##
============================================
+ Coverage     57.99%   58.01%   +0.01%     
  Complexity     9139     9139              
============================================
  Files           683      683              
  Lines         37058    37058              
  Branches       5420     5420              
============================================
+ Hits          21491    21498       +7     
+ Misses        13654    13651       -3     
+ Partials       1913     1909       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@jwnasambu jwnasambu Feb 18, 2026

Choose a reason for hiding this comment

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

kindly the word shouldn't be truncated as "ProgramWorkflowStat" instead should be full "ProgramWorkflowState"

Suggested change
<comment>Add audit columns required by ProgramWorkflowStat JPA mapping for TRUNK-5891</comment>
Add audit columns required by ProgramWorkflowState JPA mapping for TRUNK-5891

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @jwnasambu for catching both!
Apparently I was being too economical with spaces AND letters 😅 Will fix them!

@sonarqubecloud
Copy link

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.

4 participants

Comments