2019-09-04 11:37:43,951 ERROR (org.hibernate.hql.internal.ast.ErrorCounter:55)- line 1:9: unexpected token: *
@Query(value = “select * from table”)
public int test();
上面是报错,下面是sql语句。
之前也遇到过这个问题,再遇到又忘了,开贴记录一下:
下面是解决方案
@Query(value = “select * from table”, nativeQuery = true)
public int test();
加上 nativeQuery = true
即是启用原生sql。
不加的情况下sql语句应该是从from开始的,如下:
@Query(value = “from table”)
public int test();