0

I need to write a hql query to get all objects where a field is contains in a list of Integer.

But I have an error: unextected end of subtree

this is the request:

@Query(
        value = "SELECT DISTINCT sm FROM StopMatrix sm " +
            "JOIN FETCH sm.provider p " +
            "LEFT JOIN FETCH sm.authorizedStopCollection aus " +
            "LEFT JOIN FETCH aus.cstopStart cs " +
            "LEFT JOIN FETCH aus.cstopEnd ce " +
            "WHERE p.proCode IN (:allowedProviderCodes)"
    )
    List<StopMatrix> findAllByAllowedProviderCodes(@Param("allowedProviderCodes") List<Integer> readAllowedProviderCodes);

but I have this error:

org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [SELECT DISTINCT sm FROM com.parkeon.transfolio.fares.jpa.matrix.StopMatrix sm JOIN FETCH sm.provider p LEFT JOIN FETCH sm.authorizedStopCollection aus LEFT JOIN FETCH aus.cstopStart cs LEFT JOIN FETCH aus.cstopEnd ce WHERE p.proCode IN ()]

Does anyone know how to resolve it?

Thanks you

2
  • 1
    you should have at leas 1 element in readAllowedProviderCodes list Commented Mar 6, 2024 at 11:04
  • 1
    Thank you for responding quickly. I added a check that the list is not empty and the error no longer appears. Thank you so much Commented Mar 6, 2024 at 11:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.