Using postgis functions in hibernate SQL Query -


i need execute select st_astext(column_name) table using hibernate createsqlquery().

when executed query, shows column name not found in result set.
when execute same query in pgadmin browser, query works.

query query = session.createsqlquery("select st_astext(end2536) country          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) not read column value result set: end2536; column name end2536 not found in 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) column name end2536 not found in resultset. 16:56:27,080 error [stderr] (http--172.20.211.235-8080-1) org.hibernate.exception.sqlgrammarexception: not execute query 

what missing here?

the error message quite clear - says

the column name end2536 not found in resultset.

so if work in client, seems hibernate changes query somehow.

enable sql queries logging described here , check hibernate sends.


Comments