com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的 SQL 语法在 'OPTION SQL_SELECT_LIMIT=DEFAU



此查询返回以下错误。 任何人都知道???

@SqlQuery("SELECT * FROM employee WHERE id = (:id) ")
Employee getByid(@Bind("id") Integer id);

结果:

2018-08-29 11:12:19.532 ERROR 9736 --- [nio-8080-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet]    :
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; 
nested exception is org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: Could not clean up 
[statement:"SELECT * FROM employee WHERE id = (:id) ", located:"SELECT * FROM employee WHERE id = (:id) ", 
rewritten:"SELECT * FROM employee WHERE id = (?) ", arguments:{ positional:{}, named:{id:1}, finder:[]}]] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax 
to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1

这是因为你的语法有问题。您用方括号 (( 将参数括起来。

试试这个:

@SqlQuery("SELECT * FROM employee WHERE id = :id ")