Fixed some hibernate-query parameter errors, enabled the echart.#14
Fixed some hibernate-query parameter errors, enabled the echart.#14yingbull merged 1 commit intodevelop/bullfrogfrom
Conversation
Reviewer's Guide by SourceryThis PR fixes Hibernate query parameter indexing issues in CaseManagementNoteDAOImpl.java. The changes update the parameter placeholders from '?' to indexed placeholders '?0', '?1', etc., to ensure correct parameter binding in the HQL queries. Class diagram for CaseManagementNoteDAOImpl changesclassDiagram
class CaseManagementNoteDAOImpl {
+List<CaseManagementNote> getNotes(List<Long> ids)
+CaseManagementNote getMostRecentNote(String uuid)
+List<CaseManagementNote> getCPPNotes(String demoNo, long issueId, String uuid)
+List<CaseManagementNote> getNotesByDemographic(String demographic_no, String uuid)
+List<CaseManagementNote> getNotesByDemographicSince(String demographic_no, Date date)
+long getNotesCountByDemographicId(String demographic_no)
+List<Object[]> getRawNoteInfoByDemographic(String demographic_no)
+List<Map<String, Object>> getRawNoteInfoMapByDemographic(String demographic_no)
+List<Map<String, Object>> getUnsignedRawNoteInfoMapByDemographic(String demographic_no)
+List<CaseManagementNote> searchDemographicNotes(String demographic_no, String searchString)
+List<CaseManagementNote> getCaseManagementNoteByProgramIdAndObservationDate(Integer programId, Date minObservationDate, Date maxObservationDate)
+List<CaseManagementNote> getMostRecentNotesByAppointmentNo(int appointmentNo)
+List<CaseManagementNote> getMostRecentNotes(Integer demographicNo)
+List<Integer> getNotesByFacilitySince(Date date, List<Program> programs)
+int getNoteCountForProviderForDateRange(String providerNo, Date startDate, Date endDate)
+int getNoteCountForProviderForDateRangeWithIssueId(String providerNo, Date startDate, Date endDate, String issueCode)
}
note for CaseManagementNoteDAOImpl "Updated HQL queries to use indexed placeholders for parameters."
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @kateyang1998 - I've reviewed your changes - here's some feedback:
Overall Comments:
- In getNoteCountForProviderForDateRange(), the SQL query uses ?1, ?2, ?3 but the PreparedStatement uses indices 1,2,3. This mismatch could cause errors - either change the SQL to use ?0, ?1, ?2 or adjust the PreparedStatement indices accordingly.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| @Override | ||
| public CaseManagementNote getMostRecentNote(String uuid) { | ||
| String hql = "select distinct cmn from CaseManagementNote cmn where cmn.uuid = ?0 and cmn.id = (select max(cmn.id) from cmn where cmn.uuid = ?0)"; | ||
| String hql = "select distinct cmn from CaseManagementNote cmn where cmn.uuid = ?0 and cmn.id = (select max(cmn.id) from cmn where cmn.uuid = ?1)"; |
There was a problem hiding this comment.
issue (bug_risk): Parameter numbering inconsistency could cause bugs
The subquery should use ?0 instead of ?1 since it's referring to the same uuid parameter. Using different parameter numbers for the same value could lead to incorrect parameter binding.
There was a problem hiding this comment.
Both of these parameters should be ?0. They use the same value.
There was a problem hiding this comment.
Hi @sebastian-j-ibanez! 👋
Only authors and team members can run @sourcery-ai commands on public repos.
sebastian-j-ibanez
left a comment
There was a problem hiding this comment.
Just one small change to make.
See my comment on the Sourcery comment.
| @Override | ||
| public CaseManagementNote getMostRecentNote(String uuid) { | ||
| String hql = "select distinct cmn from CaseManagementNote cmn where cmn.uuid = ?0 and cmn.id = (select max(cmn.id) from cmn where cmn.uuid = ?0)"; | ||
| String hql = "select distinct cmn from CaseManagementNote cmn where cmn.uuid = ?0 and cmn.id = (select max(cmn.id) from cmn where cmn.uuid = ?1)"; |
There was a problem hiding this comment.
Both of these parameters should be ?0. They use the same value.
58afd75 to
d0b8a41
Compare
Fix ClassCastException using TypedQuery
fixed: while removing acknowledged provider, their comments were getting archived
Summary by Sourcery
Fix hibernate query parameter indexing errors and enable echart functionality.
Bug Fixes:
Enhancements: