2

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.