Skip to content

[BUG] Spring count @Query with java text block generates an error #47910

@Blackbaud-JasonBodnar

Description

@Blackbaud-JasonBodnar

Describe the bug
If you have an @Query with the query text in a java text block ("""...""") the query generates an error.

Exception or Stack Trace

java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.Long (java.util.ArrayList and java.lang.Long are in module java.base of loader 'bootstrap')

To Reproduce

  1. Create a method on a Spring a Spring repository
  2. Annotate it with @Query(). The query should be a COUNT query in a java text block.
  3. Create a test that uses the method.
  4. Run the test.

Code Snippet

@Query(value = """
                    SELECT VALUE COUNT(1)
                    FROM a
                    WHERE a.city = @city
                    AND a.state = @state
            """)
long countCityAndState(String city, String state);

Expected behavior
The method should return the count from the query.

Setup (please complete the following information):

  • OS: Ubuntu 24.04.3 LTS
  • IDE: IntelliJ
  • Library/Libraries: azure-spring-data-cosmos:5.20.0
  • Java version: Azul Zule 19.0.2
  • Frameworks: Spring Boot

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ X ] Bug Description Added
  • [ X ] Repro Steps Added
  • [ X ] Setup information Added

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.azure-springAll azure-spring related issuescustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions