Reputation: 4424
I need to execute select ST_AsText(column_name)
from table using hibernate createSQlQuery().
When i executed that query, it fires an exception
.
But when i execute the same query using simple JDBC or in my PGAdmin browser
, the query works.
Below is my query:
select st_astext(linkPoints) from linkRoute
Exception:
SEVERE: ERROR: relation "linkroute" does not exist
Mapping File
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.lnt.utility.pojo.linkRoute" table="link_route">
<id name="Id" column="id">
<generator class="assigned" />
</id>
<property name="linkName" column="link_name"/>
<property name="distance" column="distance"/>
<property name="idNo" column="idno"/>
<property name="speed" column="speed"/>
<property name="linkPoints" column="link_points"/>
</class>
</hibernate-mapping>
Pls help
Upvotes: 2
Views: 489
Reputation: 399
Hibernate provide a createSQLQuery method to let you call your native SQL statement directly.
I hope you should be able to work with your query using nativequery else you should go for Hibernate Spatial.
Please find the link for more information on hibernate native query tutorial. Hope this helps.
Upvotes: 1