java - Unexpected Token ":" in Spring @Query Param -
i have spring repository @query named parameters in application:
@query("select p :person") page<person> find(@param("table") string table, pageable pageable);
and controller handle request/query table (:table)
@requestmapping(value = "/search/{table}", produces="application/json", method = requestmethod.get) public page<person> searchtables(@pathvariable string table) { return page<person> list = repo.find(table, new pagerequest(1, 20)); }
the repository , request mapping working i've omitted those, getting following exception:
caused by: org.hibernate.hql.internal.ast.querysyntaxexception: unexpected token: : near line 1, column 15 [select p :table]
according spring docs how @query
named params prefixed :
, i'm not sure why getting error.
from docs:
...you can use @param annotation give method parameter concrete name , bind name in query.
any ideas?
please, see #{#entityname} link(spring-data): http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query.spel-expressions .
Comments
Post a Comment