java spring : unexpected token: *

Jeff :

In my jpa interface, i have the following code:

public interface ConsultationRequestRepository extends CrudRepository<ConsultationRequest, Integer> {

    @Query("select * from ConsultationRequest where status = ?1")
    List<ConsultationRequest> findRequestsByStatus(ConsultationStatus status);
}

but it complains with the error:

antlr.NoViableAltException: unexpected token: *

what is wrong in this code?

eparvan :

Try to change your query in the following way:

@Query("select c from ConsultationRequest c where c.status = ?1")

Or you can use native query:

@Query("select * from ConsultationRequest where status = ?1", nativeQuery = true)

More about using @Query annotation you can find here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related