春季@Query删除报价




我想在 spring 查询中使用表名, 但是当我执行它时,我收到以下错误:

"could not extract ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet"


因为弹簧添加自动引用" 当参数是字符串参数时..

@Query(value = "desc :name", nativeQuery = true)
List<RepositoryColumn> getColumnFromRepository(@Param("name") String name);

在其他情况下,我想要"desc table_name"而不是"desc 'table_Name'"

知道吗?

SELECT *
FROM information_schema.columns
WHERE 
table_name = :name 

尝试另一种方式。您可以选择必要的列,而不是*

最新更新