我有一个名为@id
我想执行此查询的列的表:
select DISTINCT "@id" from "osm_art_center"
Run Code Online (Sandbox Code Playgroud)
在 Java(休眠)中。
问题是 Hibernate 无法理解@id并返回 id 列不存在的错误。
编辑
导致错误的代码:
String columnName="@id";
String tableName="osm_art_center";
ResultSet polygonSearch;
polygonSearch = st.executeQuery("select DISTINCT "+columnName+" from "+tableName);
Run Code Online (Sandbox Code Playgroud)
已抛出的错误:
SQL Error: org.postgresql.util.PSQLException: ERROR: column "id" does not exist
Run Code Online (Sandbox Code Playgroud)