I need to execute select ST_AsText(column_name)
from table using hibernate createSQlQuery()
.
When i executed that query, it shows that the column name is not found in the result set.
But when i execute the same query in my PGAdmin browser, the query works.
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");
Error Msg:
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
What am i missing here?