I am trying to execute a custom query through jpa repository interface like this:
@Query(
value = "SELECT (TRIM(TYPE_NAME) ||'.'|| TRIM(NAME)) AS NAMES FROM ?1",
nativeQuery = true)
public List<String> getNamesFromView( String viewName);
I want to pass the name of the table to fetch from, dynamically by the user.
I am getting runtime exception
nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement
If I hardcode the table name, this is working fine