While using a verbatim entered column name works fine in an SQL/JPA query, is it possible to use a variable?
@Query(value = "select distinct ?1 from Product", nativeQuery = true)
List<String> findOneColumn(String columnName);
This code appears to fail. It seems that it's not allowed to use parameters in SELECT clause (but works with WHERE clause). Is there any alternatives?
How can I set the column name dynamically?