我需要select ST_AsText(column_name)
使用 hibernate 从表中执行createSQlQuery()
。
当我执行该查询时,它显示在结果集中找不到列名。
但是当我在我的 PGAdmin 浏览器中执行相同的查询时,该查询有效。
Query query = session.createSQLQuery("select ST_AsText(END2536) from country where object='something'");
((SQLQuery) query).addScalar(column, Hibernate.STRING);
String geomValue = (String) query.uniqueResult();
query.setCacheable(true);
query.setCacheRegion("query.CommonManagement");
错误消息:
16:56:27,076 INFO [org.hibernate.type.StringType] (http--172.20.211.235-8080-1) could not read column value from result set: END2536; The column name END2536 was not found in this ResultSet.
16:56:27,077 WARN [org.hibernate.util.JDBCExceptionReporter] (http--172.20.211.235-8080-1) SQL Error: 0, SQLState: 42703
16:56:27,077 ERROR [org.hibernate.util.JDBCExceptionReporter] (http--172.20.211.235-8080-1) The column name END2536 was not found in this ResultSet.
16:56:27,080 ERROR [stderr] (http--172.20.211.235-8080-1) org.hibernate.exception.SQLGrammarException: could not execute query
我在这里想念什么?