Skip to content

Conversation

@raulbob
Copy link
Contributor

@raulbob raulbob commented Dec 9, 2025

Fixes issue with transaction in UserService.isPortHealthUser() method leading to "No Session" errors while called from aggregate reports in some cases.

Summary by CodeRabbit

  • Chores
    • Enhanced transaction handling in user service operations to improve system reliability and data consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

Walkthrough

A @Transactional annotation with TxType.REQUIRED was added to the isPortHealthUser() method in UserService, along with the corresponding import statement. No method signature or behavior was altered.

Changes

Cohort / File(s) Summary
Transaction boundary addition
sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java
Added javax.transaction.Transactional import and annotated isPortHealthUser() method with @Transactional(Transactional.TxType.REQUIRED) to enforce transaction requirements.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Single-file change with minimal scope
  • Simple annotation addition without logic modifications
  • Import statement only adds transactional context

Suggested reviewers

  • KarnaiahPesula

Poem

🐰 A hop, a skip, a transaction's fix,
One tiny @Transactional mix,
No logic bent, just boundaries set,
UserService now won't forget! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the issue being fixed and the affected method, but does not include the required issue number reference specified in the template (Fixes #). Add the issue number reference to the description by including 'Fixes #13768' at the beginning or in a dedicated line to match the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: fixing a transaction-related issue causing 'No Session' errors in aggregate reports, which matches the code change of adding @transactional annotation to the isPortHealthUser() method.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix-aggregate_report_no_session

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6b1a94 and e02bdae.

📒 Files selected for processing (1)
  • sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: SORMAS CI
🔇 Additional comments (2)
sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java (2)

43-43: LGTM!

The import is correctly added for the @Transactional annotation used on the isPortHealthUser() method.


926-931: @transactional(TxType.REQUIRED) correctly addresses lazy-loading issue in aggregate reports.

The annotation ensures an active EntityManager session exists when accessing user.getUserRoles() on line 929, preventing "No Session" errors. The REQUIRED propagation type is appropriate as it joins any existing transaction or creates a new one.

Call sites analysis confirms minimal performance impact: the method is invoked once per aggregate report operation (lines 132 and 158 in AggregateReportService and AggregateReportFacadeEjb respectively), not in loops.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sormas-vitagroup
Copy link
Contributor

@raulbob raulbob merged commit 4700166 into development Dec 9, 2025
8 of 10 checks passed
@raulbob raulbob deleted the bugfix-aggregate_report_no_session branch December 9, 2025 15:12
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