Done
Details
Details
Assignee
Sherzod Nurjonov
Sherzod NurjonovReporter
Maccabee Levine
Maccabee LevineLabels
Priority
Story Points
1
Sprint
None
Development Team
Spitfire
RCA Group
Lack of testing
TestRail: Cases
Open TestRail: Cases
TestRail: Runs
Open TestRail: Runs
Created September 14, 2022 at 6:39 PM
Updated October 17, 2022 at 8:03 AM
Resolved September 26, 2022 at 3:10 PM
How to reproduce:
Using folio-snapshot environment and the type UUID for "General note":
Create at least one note with this typeId.
Run GET /notes with a query where type.id equals the "General note" UUID and the limit parameter is very high. i.e.
/notes?limit=100000&query=(type.id="d1de14b8-4bfd-4acc-b12b-545d3e20dc0a")
The return value indicates
"totalRecords": 1
Repeat the query with limit = totalRecords.
/notes?limit=1&query=(type.id="d1de14b8-4bfd-4acc-b12b-545d3e20dc0a")
Expected result: HTTP 200 OK and a meaningful response.
Actual result: HTTP 422 Unprocessable Entity
{ "errors": [ { "message": "org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=generatedAlias2,role=org.folio.notes.domain.entity.NoteEntity.type,tableName=type,tableAlias=notetypeen2_,origin=note noteentity0_,columns={noteentity0_.type_id,className=org.folio.notes.domain.entity.NoteTypeEntity}}] [select count(generatedAlias0) from org.folio.notes.domain.entity.NoteEntity as generatedAlias0 left join generatedAlias0.type as generatedAlias1 inner join fetch generatedAlias0.type as generatedAlias2 where generatedAlias1.id=:param0]; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=generatedAlias2,role=org.folio.notes.domain.entity.NoteEntity.type,tableName=type,tableAlias=notetypeen2_,origin=note noteentity0_,columns={noteentity0_.type_id,className=org.folio.notes.domain.entity.NoteTypeEntity}}] [select count(generatedAlias0) from org.folio.notes.domain.entity.NoteEntity as generatedAlias0 left join generatedAlias0.type as generatedAlias1 inner join fetch generatedAlias0.type as generatedAlias2 where generatedAlias1.id=:param0]", "type": "-1", "code": "VALIDATION_ERROR" } ] }
Although folio-snapshot only has a single note (and folio-lotus has zero), I can reproduce this in our institution's environment with any limit <= the actual number of results. The query succeeds with any limit > the actual number of results.
Affected versions: At least 3.0.4, 3.1.2, master.
Note: Apologies for any mistakes in Jira reporting conventions, this is my first bug report against FOLIO.