Reputation: 333
I want to use a table name in spring query,
but when I execute it I got this following error:
"could not extract ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet"
Because spring add automatically quote " when param is a String param ..
@Query(value = "desc :name", nativeQuery = true)
List<RepositoryColumn> getColumnFromRepository(@Param("name") String name);
In other case I want "desc table_name"
and not "desc 'table_Name'"
Any idea?
Upvotes: 0
Views: 2088
Reputation: 57421
SELECT *
FROM information_schema.columns
WHERE
table_name = :name
Try the same another way. Instead of *
you can choose necessary columns
Upvotes: 1