Problem with $count
When refactoring I stumbled across an issue where if the request URL contains a trailing slash ans you are using an OData query to solve a findAll type query than the OData parsing becomes confused and creates a count query rather than a "list of objects"-query.
An example is:
http://localhost:8092/noark5v5/api/arkivstruktur/mappe/518fa23b-3d94-4d7e-b865-9750c002bcdd/arkivdel/
that results in the following HQL:
SELECT count(*) FROM Series AS series_1 JOIN series_1.referenceFile AS file_1 WHERE file_1.systemId = :parameter_0
However, when the trailing slash is not present the query is created properly.
SELECT series_1 FROM Series AS series_1 JOIN series_1.referenceFile AS file_1 WHERE file_1.systemId = :parameter_0
The reason for this can be found in ODataParser.g4
resourcePath:
(embeddedEntitySet | entityUUID | entity) countStatement?;
The trailing slash is making the parsin expect a countStatement resulting in the wrong HQL query.
Making a note of it here, and will revisit it in the future.